assembly/plugins/pwa-update.js

21 lines
481 B
JavaScript
Raw Normal View History

2022-01-01 15:33:25 +00:00
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.')
})
}