18 lines
511 B
JavaScript
18 lines
511 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);
|
|
});
|
|
});
|
|
});
|