skipWaiting()
A service worker method that makes a newly installed version activate immediately instead of waiting for old tabs to close.
In more detail
It is usually called in the install event handler or in response to a message from the page. It speeds up updates but means open pages may suddenly be served by new code that expects different files, so pair it with a prompt to refresh.
Related terms
- service worker lifecycle — The states a service worker passes through: installing, installed and waiting, activating, activated, and finally redundant when replaced or failed.
- clients.claim() — A service worker method that makes a newly activated worker take control of pages that are already open.
Taught in
- Service Worker Lifecycle: Installation, Activation And Update — Frontend Architecture & Web Platform