Fix scope

This commit is contained in:
Sidharth Vinod
2021-05-31 17:01:10 +05:30
parent 41e92a105c
commit 3d842a795f
+10 -1
View File
@@ -6,7 +6,16 @@
// Then move it into src and vite will bundle it automatically.
onMount(() => {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register(`${base}/service-worker.js`);
navigator.serviceWorker
.register(`${base}/service-worker.js`, {
scope: `${base}/`
})
.then(function (registration) {
console.log('Registration successful, scope is:', registration.scope);
})
.catch(function (error) {
console.log('Service worker registration failed, error:', error);
});
}
});
</script>