Web APIs

ServiceWorkerContainer.prototype.ready

Try the free JavaScript compiler

Promise resolving to a registration with an active service worker for the associated page. It does not guarantee the current page has a controller.

Formal Syntax & Structure

javascript syntaxjavascript
navigator.serviceWorker.ready

Working Example

Example Snippetjavascript
(async () => {await navigator.serviceWorker.register("./sw.js");const r=await navigator.serviceWorker.ready;console.log(Boolean(r.active));})()
JavaScript Reference