22 lines
621 B
JavaScript
22 lines
621 B
JavaScript
/* Retire stale service workers from the old HiveGrid app on this host. */
|
|
|
|
self.addEventListener("install", (event) => {
|
|
event.waitUntil(self.skipWaiting());
|
|
});
|
|
|
|
self.addEventListener("activate", (event) => {
|
|
event.waitUntil(
|
|
(async () => {
|
|
const keys = await caches.keys();
|
|
await Promise.all(keys.map((key) => caches.delete(key)));
|
|
await self.registration.unregister();
|
|
const clients = await self.clients.matchAll({ type: "window" });
|
|
await Promise.all(clients.map((client) => client.navigate(client.url)));
|
|
})()
|
|
);
|
|
});
|
|
|
|
self.addEventListener("fetch", () => {
|
|
return;
|
|
});
|