Service worker - jellyfish-tom/TIL GitHub Wiki
[SOURCES]
Service Workers are browser feature that provide event-driven scripts that run independently of web pages. They are at the core of Progressive Web Apps (PWAs)
Greatest Service Workers advantages are:
- offline access of website content
- easy mobile devices access
- non UI blocking operation
Service Workers characteristics:
- needs to be served through HTTPS
- service workers can intercept network requests
- can serve cached (cache happen during interception) resources browser is offline and the network is unavailable
- runs on a separate thread
- can’t access many objects available (because of being single threaded) in the main JavaScript thread, including access to the DOM and several APIs like XHR, or Cookies
- service workers operation can’t ever block the UI thread, because it’s completely separate
- during first webpage visit service worker can only be instaled. Only during following visits it can serve cached recources, intercept network requests etc.