From 11ece69e006b446b9ca4e06eb5af5662bc811469 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Fri, 29 Sep 2023 10:11:33 -0500 Subject: Formatting Signed-off-by: Matt Strapp --- app/src/lib/svelte/ReloadPrompt.svelte | 60 ++++++++++++++++------------------ 1 file changed, 29 insertions(+), 31 deletions(-) (limited to 'app/src/lib/svelte/ReloadPrompt.svelte') diff --git a/app/src/lib/svelte/ReloadPrompt.svelte b/app/src/lib/svelte/ReloadPrompt.svelte index d54a202..e6effbb 100644 --- a/app/src/lib/svelte/ReloadPrompt.svelte +++ b/app/src/lib/svelte/ReloadPrompt.svelte @@ -1,34 +1,32 @@ \ No newline at end of file + 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) + }, + }) + -- cgit v1.2.3