update sw.ts and toast component

This commit is contained in:
Alessio Davoli 2023-07-22 19:57:47 +02:00
parent 0a2f580f30
commit 7d8f59dec7
2 changed files with 10 additions and 9 deletions

View file

@ -5,17 +5,15 @@
let nodeRef;
onMount(() => {
show = true;
setTimeout(() => {
show = false;
show = true;
setTimeout(() => {
nodeRef.parentNode.removeChild(nodeRef);
show = false;
setTimeout(() => {
nodeRef.parentNode.removeChild(nodeRef);
}, 5000);
}, 5000);
}, 5000);
});
onDestroy(() => {
show = false;
}, 0);
});
</script>

View file

@ -24,6 +24,9 @@ self.addEventListener('install', (event) => {
event.waitUntil(addFilesToCache());
});
const channel = new BroadcastChannel('sw-messages');
self.addEventListener('activate', (event) => {
// Remove previous cached data from disk
async function deleteOldCaches() {
@ -33,7 +36,7 @@ self.addEventListener('activate', (event) => {
}
event.waitUntil(deleteOldCaches());
postMessage("completed");
channel.postMessage({title: 'Cache downloaded!'});
});
self.addEventListener('fetch', (event) => {