blob: 983cccb8db7895d8d72943061b6660a86fe99a04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
const requests = [];
let port = undefined;
self.onmessage = e => {
const message = e.data;
if ('port' in message) {
port = message.port;
port.postMessage({ready: true});
}
};
self.addEventListener('fetch', e => {
const url = e.request.url;
if (!url.includes('sample?test')) {
return;
}
port.postMessage({
url: url,
mode: e.request.mode,
redirect: e.request.redirect,
credentials: e.request.credentials,
integrity: e.request.integrity,
destination: e.request.destination
});
e.respondWith(Promise.reject());
});
|