Re: [slightlyoff/ServiceWorker] consider allowing multiple worker thread instances for a single registration (#756)

@jakearchibald Thank you for your patience in listening and explaining.  To answer the question re: clients.claim()

> It sounds like (and there's no shame in this) you're not really sure why you call it or what it does, beyond "it seems to help". Is that fair to say?

The reason I call it is that in conjunction with self.skipWaiting (which I also call in the install phase), it makes it so I don't *have* to think about the vagaries of the SW lifecycle.. i.e. it just does "what I want it to do" which is "start handling fetch events *and* messages and everything else and kill any of your older siblings while you're at it so we don't get you mixed up with each other".  Before I used it, I seemed to have a lot of problems with the SW I thought was active not being the one that handled message events, fetches, etc.  Initially, I only used self.skipWaiting and seemed to have a lot of those problems.  According to how I *thought* SWs worked, skipWaiting would be enough, but I found in *practice* that I also needed clients.claim to have it start doing what I wanted it to do in a way that was not wildly unpredictable.  So it's fair to say my practice of using clients.claim is based on some cargo-cult voodoo, but it's the bridge I've found that helps me jump the gap of how I thought SWs worked and how they actually work when I test them in Chrome.  I have no serious attachment to that facet of the API, but I'm "once bitten" on doing it any other way.  Maybe I'll go back to using just skipWaiting and see if the problems I used to have pop up again.

As Ben said above, he seems to think it would be a non-problem for implementers, anyway.  So as long as that call it keeps doing "what it says on the tin" - or you can abstract it in such a way that as a SW user, it looks like it does - that's good enough for me in the context of this issue.

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

Received on Sunday, 7 August 2016 03:05:18 UTC