update service worker
This commit is contained in:
Vendored
+6
-1
@@ -14,9 +14,14 @@ document.querySelector("main").addEventListener("scroll", () => {
|
||||
async function registerServiceWorker() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
try {
|
||||
await navigator.serviceWorker.register("/sw.js", {
|
||||
const registration = await navigator.serviceWorker.register("/sw.js", {
|
||||
scope: "/",
|
||||
});
|
||||
if (registration.installing) {
|
||||
setTimeout(() => window.location.reload(), 500);
|
||||
} else if (registration.active) {
|
||||
console.log("Service worker active");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Could not install service worker: ${error}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user