October 2017
Intermediate to advanced
302 pages
7h 27m
English
A service worker is a bit of JavaScript that sits between our application and the network.
You can think of a script that runs outside the context of our application, but with which we can communicate from within the bounds of our code. It's a piece of our application, but separate from the rest.
The easiest example is in the context of caching files (which we’ll explore in the upcoming chapters). Let’s say that our application, when the user navigates to https://chatastrophe.com, goes and fetches our icon.png file.
A service worker, if we configure it, will sit between our app and the network. When our app requests the icon file, the service worker intercepts that request and checks the local cache for the file. ...
Read now
Unlock full access