Port 0172d819f7882db3dd4f1350c01e5d728924bc86 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
23 lines
753 B
TypeScript
23 lines
753 B
TypeScript
/// <reference lib="WebWorker" />
|
|
/// <reference types="vite/client" />
|
|
|
|
import { cacheRoot, handleFetch } from './caching';
|
|
import { handleNotificationClick, handlePush } from './web_push_notifications';
|
|
|
|
declare const self: ServiceWorkerGlobalScope;
|
|
|
|
// Cause a new version of a registered Service Worker to replace an existing one
|
|
// that is already installed, and replace the currently active worker on open pages.
|
|
self.addEventListener('install', (event) => {
|
|
event.waitUntil(cacheRoot());
|
|
});
|
|
|
|
self.addEventListener('activate', (event) => {
|
|
event.waitUntil(self.clients.claim());
|
|
});
|
|
|
|
self.addEventListener('fetch', handleFetch);
|
|
|
|
self.addEventListener('push', handlePush);
|
|
self.addEventListener('notificationclick', handleNotificationClick);
|