Skip waiting, update service worker

file-group-page
bat 3 years ago
parent a5b043cd43
commit 5d3026ae6b

@ -12,8 +12,9 @@ customElements.define('m-page-menu', PageMenu)
class Setup { class Setup {
async run() { async run() {
navigator.serviceWorker const sw = navigator.serviceWorker
.addEventListener('controllerchange', () => {
sw.addEventListener('controllerchange', () => {
if (this.registration.active) { if (this.registration.active) {
window.location.reload(true) window.location.reload(true)
} }

@ -13,6 +13,7 @@ async function initCache() {
} }
self.addEventListener("install", event => { self.addEventListener("install", event => {
self.skipWaiting()
event.waitUntil(initCache()) event.waitUntil(initCache())
}) })

Loading…
Cancel
Save