blob: 09c82011e57420e7829dfc238763b3e0911aa2e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// A simple worker script that forward intercepted url to the controlled window.
function responseMsg(msg) {
self.clients
.matchAll({
includeUncontrolled: true,
type: "window",
})
.then(clients => {
if (clients && clients.length) {
clients[0].postMessage(msg);
}
});
}
onfetch = function (e) {
responseMsg(e.request.url);
};
|