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

This commit is contained in:
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

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: {