mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
21 lines
481 B
JavaScript
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.')
|
||
|
})
|
||
|
}
|