fix: close databases on page freeze event without pwa (#1662)

zio/stable
Joaquín Sánchez 2023-02-07 00:01:30 +01:00 committed by GitHub
parent 32cfe6371f
commit 65bbc7c790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -17,14 +17,12 @@ export default defineNuxtPlugin(() => {
frozenListeners.push(listener)
}
if (useAppConfig().pwaEnabled) {
addFrozenListener(() => {
if (navigator.serviceWorker.controller)
if (useAppConfig().pwaEnabled && navigator.serviceWorker.controller)
navigator.serviceWorker.controller.postMessage(ELK_PAGE_LIFECYCLE_FROZEN)
closeDatabases()
})
}
return {
provide: {