Service worker

2021. 9. 3. 08:17·Computer Science/Terminology and Concepts

What is Service Worker:
A service worker is a script that runs independently in the browser background. On the user side, it can intercept its network requests and decide what to load (fetch).
Service workers mainly serve features like background sync, push notifications and they are commonly used for’offline first’ applications, giving the developers the opportunity to take complete control over the user experience.

 

The service worker life cycle:
The service worker lifecycle is completely separate from the web page. It’s a programmable network proxy, which is terminated when it’s not used and restarted when it’s next needed. Service Workers heavily rely on the use of Javascript Promises.

 

During installation, the service worker can cache some static assets like web pages. If the browser cache the files successfully, the service worker gets installed.

Afterward, the worker needs to be activated. During activation the service worker can manage and decide what to happen to the old caches, typically they are being deleted and replaced with the new versions.

 

Lastly, after activation, the service worker takes control over all pages in his scope, without the page which initially registered the service worker, which needs to be refreshed. The service worker is smart in terms of memory usage and will be terminated if there is nothing to fetch and there are no message events occurring.

 

Service Worker can’t:

  • Access the Parent Object
  • Access the Window Object
  • Access the Document Object
  • Access the DOM

However, the Service Worker can:

  • Cache Assets & API calls
  • Manage Push Notifications
  • Control the Network Traffic
  • Store the Application Cache

Common use cases:

  • Offline-optimized experience
  • Sending Push Notifications
  • Background sync

 

Source from: https://www.geeksforgeeks.org/service-workers-in-javascript/

'Computer Science > Terminology and Concepts' 카테고리의 다른 글

dependencies version in package.json  (0) 2021.10.16
What is JSON File ?  (0) 2021.09.09
CDN  (0) 2021.08.01
PWA  (0) 2021.08.01
SPA - CSR/SSR/SSG  (0) 2021.08.01
'Computer Science/Terminology and Concepts' 카테고리의 다른 글
  • dependencies version in package.json
  • What is JSON File ?
  • CDN
  • PWA
JTB
JTB
웹/앱 개발 정보를 공유하고 있습니다.
  • JTB
    JTechBlog
    JTB
  • 전체
    오늘
    어제
    • All About Programming;) N
      • Computer Science
        • Terminology and Concepts
        • Network
        • Operating System
        • Database
        • Data Structure
      • Frontend
        • Javascript Essentials
        • Perfomance Optimization
        • JS Patterns
        • Next.js
        • Flutter
      • Backend
        • Node.js
      • DevOps
        • Docker & Kubernetes
      • Coding Test N
        • LeetCode N
        • Programmers
      • Tech Books & Lectures
        • Javascript_Modern JS Deep d..
        • Network_IT 엔지니어를 위한 네트워크 입문
      • Projects
        • PolyLingo_2025
        • Build Your Body_2024
        • JStargram_2021
        • Covid19 Tracker_2021
        • JPortfolio_2021
      • BootCamp_Codestates
        • TIL
        • TILookCloser
        • Pre Tech Blog
        • IM Tech Blog
        • Daily Issues and DeBugging
        • First Project
        • Final Project
        • Sprint Review
        • Good to Know
        • Socrative Review
        • HTML & CSS
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • 글쓰기
    • 관리
  • 공지사항

  • 인기 글

  • 태그

    Binary Tree BFS
    testing
    Shared resources
    Time complexity and Space complexity
    mobile app
    DOM
    structure of os
    js pattern
    indie hacker
    딥다이브
    Network
    Threads and Multithreading
    JavaScript
    프론트엔드 성능 최적화 가이드
    자바스크립트
    커리어
    TCP/IP
    CPU scheduling algorithm
    database
    자바스크립트 딥다이브
    need a database
    Operating System
    polylingo
    How memory manage data
    Data Structure
    leetcode
    이벤트
    모던 자바스크립트 Deep Dive
    스코프
    VoiceJournal
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
JTB
Service worker
상단으로

티스토리툴바