blob: f07a44e233ea345e468429bb0b71864df408a2d6 (
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
27
|
onfetch = function (e) {
if (/\/clientId$/.test(e.request.url)) {
e.respondWith(new Response(e.clientId));
}
};
onmessage = function (e) {
dump("MatchAllPropertiesWorker:" + e.data + "\n");
self.clients.matchAll().then(function (res) {
if (!res.length) {
dump("ERROR: no clients are currently controlled.\n");
}
for (i = 0; i < res.length; i++) {
client = res[i];
response = {
type: client.type,
id: client.id,
url: client.url,
visibilityState: client.visibilityState,
focused: client.focused,
frameType: client.frameType,
};
client.postMessage(response);
}
});
};
|