Re: [ServiceWorker] Promise on navigator.serviceWorker that resolves when page is controlled (#799)

`.ready` resolution could be left as-is, and there could be a new promise, perhaps named `.controlled`, that resolves when there's a controller for the current page.

I see this as being useful primarily for writing unit tests, when the "progressive enhancement/I don't care if there's a controller or not" aspects of service worker isn't relevant, and you really need to delay execution until there's a controller. If you're writing tests that already use promises (because they're using `fetch`, for instance) then having to mix in `controllerchanged` event listeners as well ends up feeling messy.

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/799#issuecomment-164778607

Received on Tuesday, 15 December 2015 14:22:19 UTC