diff options
author | Matt Strapp <matt@mattstrapp.net> | 2024-01-20 11:27:31 -0600 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2024-01-20 11:31:35 -0600 |
commit | e2b3df0508751d982c76752435390e958eb73b13 (patch) | |
tree | 76f5a004b10b232027b6a925c2f8fd2321c448a7 /clients/www/src/lib/components | |
parent | Update pnpm-lock (diff) | |
download | zorascript-e2b3df0508751d982c76752435390e958eb73b13.tar zorascript-e2b3df0508751d982c76752435390e958eb73b13.tar.gz zorascript-e2b3df0508751d982c76752435390e958eb73b13.tar.bz2 zorascript-e2b3df0508751d982c76752435390e958eb73b13.tar.lz zorascript-e2b3df0508751d982c76752435390e958eb73b13.tar.xz zorascript-e2b3df0508751d982c76752435390e958eb73b13.tar.zst zorascript-e2b3df0508751d982c76752435390e958eb73b13.zip |
Migrate repos
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to '')
-rw-r--r-- | clients/www/src/lib/components/ReloadPrompt.svelte | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/clients/www/src/lib/components/ReloadPrompt.svelte b/clients/www/src/lib/components/ReloadPrompt.svelte new file mode 100644 index 0000000..e6effbb --- /dev/null +++ b/clients/www/src/lib/components/ReloadPrompt.svelte @@ -0,0 +1,32 @@ +<script lang="ts"> + import { getToastStore } from '@skeletonlabs/skeleton' + import { useRegisterSW } from 'virtual:pwa-register/svelte' + + const toastStore = getToastStore() + + const { updateServiceWorker } = useRegisterSW({ + onRegisteredSW(r) { + console.log('SW Registered: ', r) + }, + onNeedRefresh() { + toastStore.trigger({ + message: 'A new version of the application is available.', + autohide: false, + action: { + label: 'Refresh', + response: updateServiceWorker, + }, + }) + }, + onOfflineReady() { + toastStore.trigger({ + background: 'variant-filled-success', + message: 'Now ready for offline use!', + timeout: 5000, + }) + }, + onRegisterError(err) { + console.error('SW Registration Error: ', err) + }, + }) +</script> |