blob: 6850e01da9f1b66fccdf3a8f1789611743b81bbd [file] [log] [blame]
oninstall = (event) => {
if (self.port)
return;
event.waitUntil(new Promise(resolve => self.installingPromiseResolve = resolve));
}
onmessage = (event) => {
if (event.data.port)
self.port = event.data.port;
if (self.installingPromiseResolve) {
self.installingPromiseResolve();
self.installingPromiseResolve = null;
}
if (self.activatingPromiseResolve) {
self.activatingPromiseResolve();
self.activatingPromiseResolve = null;
}
};
onactivate = (event) => {
event.waitUntil(new Promise(resolve => self.activatingPromiseResolve = resolve));
self.port.postMessage("activating");
}
self.addEventListener('fetch', (event) => {
if (event.request.url.includes("no-fetch-event-handling"))
return;
event.respondWith(fetch(event.request));
});