1e9b7a8aa2
* remove cross-env * append build hash to service worker cache names for easy purge
15 lines
435 B
TypeScript
15 lines
435 B
TypeScript
import { deleteCaches } from "./cache-utils";
|
|
|
|
declare const 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();
|
|
}
|
|
|
|
await deleteCaches(); // TODO: maybe wait for the user to reload before busting the cache
|
|
}
|