Re: [w3c/ServiceWorker] ready promise is kind of weird with overlapping scopes (#1278)

> The latter is fine.

`.ready` seems like the case of https://www.w3.org/2001/tag/doc/promises-guide#state-transitions to me. Don't we have any precedent in the platform? @annevk, wouldn't it be okay even if it's just for the "conceptual reset" with a clear note?

If we don't want to change it, developers would have to do something like:

```js
let reg = await navigator.serviceWorker.ready;
const latestReg = await navigator.serviceWorker.getRegistration();
if (reg !== latestReg) {
  waitForState(latestReg.installing, 'activating');
  reg = latestReg;
}
```

Or should we provide a method (e.g. `ready()`) that could eventually deprecate `ready` property?

-- 
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/1278#issuecomment-366602989

Received on Monday, 19 February 2018 06:56:11 UTC