service worker lifecycle

The states a service worker passes through: installing, installed and waiting, activating, activated, and finally redundant when replaced or failed.

In more detail

The install event is where you precache files; if it fails the worker becomes redundant. A new version then waits until no tabs use the old one, so a page is never controlled by two versions. The activate event is where old caches and data are cleaned up.

Related terms

Taught in

References