reload sw page after loading

This commit is contained in:
Pooya Parsa 2020-11-03 23:27:38 +01:00
parent 1a6a4cb248
commit 55819d52e0

View File

@ -10,8 +10,10 @@
window.addEventListener('load', () => { window.addEventListener('load', () => {
navigator.serviceWorker.register('/nuxt.sw.js').then((registration) => { navigator.serviceWorker.register('/nuxt.sw.js').then((registration) => {
console.log('ServiceWorker registration successful with scope:', registration.scope) console.log('ServiceWorker registration successful with scope:', registration.scope)
window.location.reload()
}).catch(error => { }).catch(error => {
console.error('ServiceWorker registration failed:', error) console.error('ServiceWorker registration failed:', error)
document.write(error)
}) })
}) })
</script> </script>