feat: unregister sw for now
This commit is contained in:
parent
f42b1b313c
commit
e25fa1a941
1 changed files with 29 additions and 21 deletions
|
@ -40,26 +40,34 @@ if (url)
|
|||
<Serialize id="app-config" data={appConfig} />
|
||||
|
||||
<script>
|
||||
const registerSW = async () => {
|
||||
if ("serviceWorker" in navigator) {
|
||||
try {
|
||||
const registration = await navigator.serviceWorker.register("/sw.js", {
|
||||
scope: "/",
|
||||
});
|
||||
if (registration.installing) {
|
||||
console.log("Service worker installing");
|
||||
} else if (registration.waiting) {
|
||||
console.log("Service worker installed");
|
||||
} else if (registration.active) {
|
||||
console.log("Service worker active");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Registration failed with ${error}`);
|
||||
}
|
||||
} else {
|
||||
console.log('browser doesn\'t support service workers. boo')
|
||||
}
|
||||
}
|
||||
|
||||
registerSW();
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
for (const registration of registrations) {
|
||||
console.log('unregistering sw...')
|
||||
registration.unregister();
|
||||
}
|
||||
});
|
||||
|
||||
// const registerSW = async () => {
|
||||
// if ("serviceWorker" in navigator) {
|
||||
// try {
|
||||
// const registration = await navigator.serviceWorker.register("/sw.js", {
|
||||
// scope: "/",
|
||||
// });
|
||||
// if (registration.installing) {
|
||||
// console.log("Service worker installing");
|
||||
// } else if (registration.waiting) {
|
||||
// console.log("Service worker installed");
|
||||
// } else if (registration.active) {
|
||||
// console.log("Service worker active");
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error(`Registration failed with ${error}`);
|
||||
// }
|
||||
// } else {
|
||||
// console.log('browser doesn\'t support service workers. boo')
|
||||
// }
|
||||
// }
|
||||
|
||||
// registerSW();
|
||||
</script>
|
Loading…
Reference in a new issue