MCPcopy
hub / github.com/leaningtech/webvm / serviceWorkerRegister

Function serviceWorkerRegister

serviceWorker.js:80–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78}
79
80async function serviceWorkerRegister() {
81 if (window.crossOriginIsolated) return;
82 if (!window.isSecureContext) {
83 console.log("Service Worker not registered, a secure context is required.");
84 return;
85 }
86 // Register the service worker and reload the page to transfer control to the serviceworker.
87 if ("serviceWorker" in navigator)
88 await doRegister();
89 else
90 console.log("Service worker is not supported in this browser");
91}
92
93if (typeof window === 'undefined') // If the script is running in a Service Worker context
94 serviceWorkerInit()

Callers 1

serviceWorker.jsFile · 0.85

Calls 1

doRegisterFunction · 0.85

Tested by

no test coverage detected