2023-07-12 00:50:01 +01:00
|
|
|
// 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) {
|
2023-07-12 21:00:28 +01:00
|
|
|
console.log(`Unregistering service worker`);
|
|
|
|
self.registration
|
|
|
|
.unregister()
|
2023-07-12 00:50:01 +01:00
|
|
|
.then(function () {
|
|
|
|
return self.clients.matchAll();
|
|
|
|
})
|
|
|
|
.then(function (clients) {
|
2023-07-12 21:00:28 +01:00
|
|
|
clients.forEach((client) => {
|
|
|
|
console.log(`Navigating ${client.url}`);
|
|
|
|
client.navigate(client.url);
|
|
|
|
});
|
2023-07-12 00:50:01 +01:00
|
|
|
});
|
2023-07-12 21:00:28 +01:00
|
|
|
});
|