16 lines
499 B
JavaScript
16 lines
499 B
JavaScript
|
// Remove the service worker /sw.js from legacy installations
|
||
|
// This should then enable the new /service-worker.js to be installed
|
||
|
|
||
|
self.addEventListener('activate', function (e) {
|
||
|
console.log(`Unregistering service worker`)
|
||
|
self.registration.unregister()
|
||
|
.then(function () {
|
||
|
return self.clients.matchAll();
|
||
|
})
|
||
|
.then(function (clients) {
|
||
|
clients.forEach(client => {
|
||
|
console.log(`Navigating ${client.url}`)
|
||
|
client.navigate(client.url)
|
||
|
})
|
||
|
});
|
||
|
});
|