mapcomplete/src/InstallServiceWorker.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
412 B
TypeScript
Raw Normal View History

2023-09-27 22:21:35 +02:00
export {}
window.addEventListener("load", async () => {
if (!("serviceWorker" in navigator)) {
console.log("Service workers are not supported")
return
}
try {
await navigator.serviceWorker.register("/service-worker.js")
console.log("Service worker registration successful")
} catch (err) {
console.error("Service worker registration failed", err)
}
})