2022-06-05 23:11:21 +02:00
|
|
|
import { deleteCaches } from "./cache-utils";
|
|
|
|
|
2022-06-01 23:56:37 +02:00
|
|
|
declare let self: ServiceWorkerGlobalScope;
|
|
|
|
|
|
|
|
export default async function handleActivate(event: ExtendableEvent) {
|
|
|
|
console.debug("Service worker activated");
|
|
|
|
// @ts-ignore
|
|
|
|
if (self.registration.navigationPreload) {
|
|
|
|
// @ts-ignore
|
|
|
|
await self.registration.navigationPreload.enable();
|
|
|
|
}
|
2022-06-05 23:11:21 +02:00
|
|
|
|
2022-06-06 00:34:50 +02:00
|
|
|
await deleteCaches(); // TODO: maybe wait for the user to reload before busting the cache
|
2022-06-01 23:56:37 +02:00
|
|
|
}
|