From a401344c5329f3ede0f68696a2a10b005873c7a0 Mon Sep 17 00:00:00 2001 From: Weston Lee Date: Mon, 19 Aug 2024 10:40:01 +0800 Subject: [PATCH] fix: Correct parameter handling in registerPeriodicSync function - Corrected the parameter order in the `registerPeriodicSync` function calls. - Ensured proper handling of Service Worker state changes and event listeners. This update ensures that the periodic sync registration is set up correctly. --- templates/template-vue/src/components/PWABadge.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/template-vue/src/components/PWABadge.vue b/templates/template-vue/src/components/PWABadge.vue index b58cecc..a00914c 100644 --- a/templates/template-vue/src/components/PWABadge.vue +++ b/templates/template-vue/src/components/PWABadge.vue @@ -39,7 +39,7 @@ const { offlineReady, needRefresh, updateServiceWorker } = useRegisterSW({ if (period <= 0) return if (r?.active?.state === 'activated') { swActivated.value = true - registerPeriodicSync(period, swUrl, r) + registerPeriodicSync(swUrl, r) } else if (r?.installing) { r.installing.addEventListener('statechange', (e) => { @@ -47,7 +47,7 @@ const { offlineReady, needRefresh, updateServiceWorker } = useRegisterSW({ const sw = e.target swActivated.value = sw.state === 'activated' if (swActivated.value) - registerPeriodicSync(period, swUrl, r) + registerPeriodicSync(swUrl, r) }) } },