Summary
The service worker life cycle looks simple until you start working with service workers. Understanding how the life cycle executes is helpful so that you can understand what the state of your service worker is.
The service worker life cycle is designed to help us avoid situations where you upgrade and could potentially break the application. A new service worker can be registered, but wait for any existing clients to close. When safe, you could use the skipWaiting method to allow a new service worker to immediately take control.
More complex applications may also have multiple service workers with different scopes. This allows larger applications to silo control across the different sub applications.
Now that you have a foundation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access