blob: 4035a8b19b902b26e868897f6e07e9bd1a27dfe6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
var requests = [];
self.addEventListener('message', function(event) {
event.waitUntil(self.clients.matchAll()
.then(function(clients) {
var client_urls = [];
for(var client of clients){
client_urls.push(client.url);
}
client_urls = client_urls.sort();
event.data.port.postMessage(
{clients: client_urls, requests: requests});
requests = [];
}));
});
self.addEventListener('fetch', function(event) {
requests.push(event.request.url);
event.respondWith(fetch(event.request));
});
|