mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
Revert "feat: optimize PWA service worker update strategy for better caching"
This reverts commit 5856db6781.
This commit is contained in:
+8
-6
@@ -11,18 +11,20 @@ async function bootstrap() {
|
||||
await loadTelegramSdk()
|
||||
}
|
||||
|
||||
registerSW({
|
||||
immediate: true,
|
||||
const updateSW = registerSW({
|
||||
onNeedRefresh() {
|
||||
if (confirm('New version available! Reload to update?')) {
|
||||
updateSW(true)
|
||||
}
|
||||
},
|
||||
onOfflineReady() {
|
||||
console.log('App ready for offline use')
|
||||
},
|
||||
onRegistered(registration) {
|
||||
if (registration) {
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.visibilityState === 'visible') {
|
||||
setInterval(() => {
|
||||
registration.update()
|
||||
}
|
||||
})
|
||||
}, 60 * 60 * 1000)
|
||||
}
|
||||
},
|
||||
onRegisterError(error) {
|
||||
|
||||
@@ -44,8 +44,6 @@ export default defineConfig({
|
||||
]
|
||||
},
|
||||
workbox: {
|
||||
skipWaiting: true,
|
||||
clientsClaim: true,
|
||||
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'],
|
||||
runtimeCaching: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user