shellphone.app/app/entry.worker.ts
m5r 1e9b7a8aa2 * fix "dev:build" watch mode
* remove cross-env
* append build hash to service worker cache names for easy purge
2022-06-11 15:13:28 +02:00

35 lines
1.0 KiB
TypeScript

/// <reference lib="WebWorker" />
import handleInstall from "./service-worker/install";
import handleActivate from "./service-worker/activate";
import handlePush from "./service-worker/push";
import handleNotificationClick from "./service-worker/notification-click";
import handleFetch from "./service-worker/fetch";
import handleMessage from "./service-worker/message";
declare const self: ServiceWorkerGlobalScope;
self.addEventListener("install", (event) => {
event.waitUntil(handleInstall(event).then(() => self.skipWaiting()));
});
self.addEventListener("activate", (event) => {
event.waitUntil(handleActivate(event).then(() => self.clients.claim()));
});
self.addEventListener("push", (event) => {
event.waitUntil(handlePush(event));
});
self.addEventListener("notificationclick", (event) => {
event.waitUntil(handleNotificationClick(event));
});
self.addEventListener("message", (event) => {
event.waitUntil(handleMessage(event));
});
self.addEventListener("fetch", (event) => {
event.respondWith(handleFetch(event));
});