Re: [w3c/ServiceWorker] Provide a one-line way to listen for a waiting Service Worker (#1222)

Since this is related to the registration, this promise should really go on the registration. That way it can be used on all the origin's registrations.

I feel that there may be a more general way to solve this. For example, what if `statechange` bubbled to the registration? Combined with https://github.com/whatwg/dom/issues/544 you could do:

```js
async function waitingWorker(reg) {
  if (reg.waiting) return;
  return reg.on('statechange').filter(e => e.target.state == 'installed').first();
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1222#issuecomment-351687900

Received on Thursday, 14 December 2017 11:42:46 UTC