assembly/plugins/pwa-update.js
Georges KABBOUCHI 8abe08ddcd PWA
2022-01-01 17:33:25 +02:00

21 lines
481 B
JavaScript

export default async function () {
const workbox = await window.$workbox
if (!workbox) {
console.debug("Workbox couldn't be loaded.")
return
}
workbox.addEventListener('installed', (event) => {
if (event.isUpdate === true) {
console.debug('There is an update for the PWA, reloading...')
// window.location.reload()
return
}
console.debug('The PWA is on the latest version.')
})
}