feat: add sw
This commit is contained in:
parent
291463061c
commit
0ea1cfc8cc
@ -1,10 +1,11 @@
|
||||
(async function () {
|
||||
console.log("Registering service worker...");
|
||||
if ("serviceWorker" in navigator) {
|
||||
try {
|
||||
const registration = await navigator.serviceWorker.register(
|
||||
"sw.js",
|
||||
{
|
||||
scope: "./",
|
||||
scope: window.location.path,
|
||||
},
|
||||
);
|
||||
if (registration.installing) {
|
||||
@ -14,6 +15,7 @@
|
||||
} else if (registration.active) {
|
||||
console.log("Service worker active");
|
||||
}
|
||||
console.log(registration);
|
||||
} catch (error) {
|
||||
console.error(`Registration failed with ${error}`);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user