2022-05-30 00:21:42 +00:00
|
|
|
/// <reference lib="WebWorker" />
|
|
|
|
|
2022-06-01 21:56:37 +00:00
|
|
|
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";
|
2022-05-30 00:21:42 +00:00
|
|
|
|
|
|
|
declare let self: ServiceWorkerGlobalScope;
|
|
|
|
|
2022-06-01 21:56:37 +00:00
|
|
|
self.addEventListener("install", (event) => {
|
|
|
|
event.waitUntil(handleInstall(event).then(() => self.skipWaiting()));
|
|
|
|
});
|
|
|
|
|
|
|
|
self.addEventListener("activate", (event) => {
|
|
|
|
event.waitUntil(handleActivate(event).then(() => self.clients.claim()));
|
|
|
|
});
|
2022-05-30 00:21:42 +00:00
|
|
|
|
|
|
|
self.addEventListener("push", (event) => {
|
2022-06-01 21:56:37 +00:00
|
|
|
event.waitUntil(handlePush(event));
|
2022-05-30 00:21:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
self.addEventListener("notificationclick", (event) => {
|
2022-06-01 21:56:37 +00:00
|
|
|
event.waitUntil(handleNotificationClick(event));
|
|
|
|
});
|
2022-05-30 00:21:42 +00:00
|
|
|
|
2022-06-01 21:56:37 +00:00
|
|
|
self.addEventListener("fetch", (event) => {
|
|
|
|
event.respondWith(handleFetch(event));
|
2022-05-30 00:21:42 +00:00
|
|
|
});
|