blob: 31f0b1bdd229a3769b4161a9918137ae2538bc3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
self.addEventListener("activate", event => {
event.waitUntil(self.clients.claim());
});
self.onfetch = function (event) {
const url = event.request.url;
const response = url.endsWith("test")
? new Response("lorem ipsum", { statusText: "OK" })
: fetch(event.request);
event.respondWith(response);
};
|