Re: [ServiceWorker] Accessing service worker state from worker (#674)

I was myself confused with the example. Basically `install` event is always dispatched at _installing worker_, so if `clients.claim()` is called on that state it'll fail. But if the service worker got to the activating/activated state (by e.g. skipWaiting()) when the method is called, it'll succeed. So, in your example, it depends on the state as such. If the service worker has been an active worker by the time the `message` event is dispatched, it'll succeed.

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

Received on Tuesday, 7 April 2015 02:11:41 UTC