match_all_properties_worker.js (675B)
1 onfetch = function (e) { 2 if (/\/clientId$/.test(e.request.url)) { 3 e.respondWith(new Response(e.clientId)); 4 } 5 }; 6 7 onmessage = function (e) { 8 dump("MatchAllPropertiesWorker:" + e.data + "\n"); 9 self.clients.matchAll().then(function (res) { 10 if (!res.length) { 11 dump("ERROR: no clients are currently controlled.\n"); 12 } 13 14 for (i = 0; i < res.length; i++) { 15 client = res[i]; 16 response = { 17 type: client.type, 18 id: client.id, 19 url: client.url, 20 visibilityState: client.visibilityState, 21 focused: client.focused, 22 frameType: client.frameType, 23 }; 24 client.postMessage(response); 25 } 26 }); 27 };