This commit is contained in:
parent
c5cca78b1c
commit
551fe07d0e
4 changed files with 21 additions and 9 deletions
|
@ -1,8 +1,23 @@
|
|||
<script>
|
||||
import BottomAppBar from '$lib/components/BottomAppBar.svelte';
|
||||
</script>
|
||||
|
||||
<slot></slot>
|
||||
if ('serviceWorker' in navigator) {
|
||||
addEventListener('load', function () {
|
||||
navigator.serviceWorker.register('../sw.ts');
|
||||
});
|
||||
|
||||
navigator.serviceWorker.addEventListener('message', (event) => {
|
||||
console.log(`The service worker sent me a message: ${event.data}`);
|
||||
alert("You can use the app offline");
|
||||
});
|
||||
|
||||
navigator.serviceWorker.ready.then((registration) => {
|
||||
console.log("registered service worker")
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<slot />
|
||||
<footer>
|
||||
<BottomAppBar />
|
||||
</footer>
|
||||
|
|
|
@ -2,13 +2,6 @@
|
|||
import Header from '$lib/components/Header.svelte';
|
||||
import Tabs from '$lib/components/Tabs.svelte';
|
||||
import MapTab from '$lib/components/tabs/MapTab.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
let syncWorker: Worker | undefined = undefined;
|
||||
|
||||
let latitude;
|
||||
let longitude;
|
||||
let accuracy;
|
||||
|
||||
export let data;
|
||||
let divider;
|
||||
|
|
|
@ -32,6 +32,7 @@ self.addEventListener('activate', (event) => {
|
|||
}
|
||||
|
||||
event.waitUntil(deleteOldCaches());
|
||||
postMessage("completed");
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
|
|
|
@ -8,6 +8,9 @@ const config = {
|
|||
files: {
|
||||
serviceWorker: 'src/sw.ts',
|
||||
},
|
||||
serviceWorker: {
|
||||
register: false,
|
||||
},
|
||||
adapter: adapter({
|
||||
fallback: null,
|
||||
precompress: true,
|
||||
|
|
Loading…
Reference in a new issue