if ("serviceWorker" in navigator) {
navigator.serviceWorker.ready.then((registration) => {
console.log(`A service worker is active: ${registration.active}`);
// At this point, you can call methods that require an active
// service worker, like registration.pushManager.subscribe()
});
} else {
console.error("Service workers are not supported.");
}ServiceWorkerContainer: ready property / notebook
ServiceWorkerContainer: ready property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.