2022-06-05 21:11:21 +00:00
|
|
|
import { deleteCaches } from "./cache-utils";
|
|
|
|
|
2022-06-11 13:13:28 +00:00
|
|
|
declare const self: ServiceWorkerGlobalScope;
|
2022-06-01 21:56:37 +00:00
|
|
|
|
|
|
|
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 21:11:21 +00:00
|
|
|
|
2022-06-05 22:34:50 +00:00
|
|
|
await deleteCaches(); // TODO: maybe wait for the user to reload before busting the cache
|
2022-06-01 21:56:37 +00:00
|
|
|
}
|