feat: add sw

This commit is contained in:
max_richter 2023-08-10 11:33:42 +02:00
parent 291463061c
commit 0ea1cfc8cc

View File

@ -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}`);
}