| OLD | NEW |
| (Empty) |
| 1 self.onmessage = function(e) { | |
| 2 var port = e.data.port; | |
| 3 var message = []; | |
| 4 | |
| 5 var promise = Promise.resolve() | |
| 6 .then(function() { | |
| 7 // 1st matchAll() | |
| 8 return self.clients.matchAll().then(function(clients) { | |
| 9 clients.forEach(function(client) { | |
| 10 message.push(client.id); | |
| 11 }); | |
| 12 }); | |
| 13 }) | |
| 14 .then(function() { | |
| 15 // 2nd matchAll() | |
| 16 return self.clients.matchAll().then(function(clients) { | |
| 17 clients.forEach(function(client) { | |
| 18 message.push(client.id); | |
| 19 }); | |
| 20 }); | |
| 21 }) | |
| 22 .then(function() { | |
| 23 // Send an array containing ids of clients from 1st and 2nd matchAll() | |
| 24 port.postMessage(message); | |
| 25 }); | |
| 26 e.waitUntil(promise); | |
| 27 }; | |
| OLD | NEW |