clients-matchall-service-worker.js (377B)
1 onmessage = e => { 2 // Collect all client URLs in this origin. 3 const options = { includeUncontrolled: true, type: 'all' }; 4 const promise = self.clients.matchAll(options) 5 .then(clients => { 6 const client_urls = []; 7 clients.forEach(client => client_urls.push(client.url)); 8 e.source.postMessage(client_urls); 9 }); 10 e.waitUntil(promise); 11 };