Re: [w3c/ServiceWorker] Create F2F agenda - 25 October 2018 (#1303)

@jakearchibald 
FWIW, there's already a [`terminate()`](https://developer.mozilla.org/en-US/docs/Web/API/Worker/terminate) for web workers. Not sure if using the same name would be confusing or better. Probably confusing if we add service worker specific options.

It's unclear to me what exactly `unregister({ force: true })` vs `terminate()` would mean. I believe the simplest MVP to accomplish what we (linkedin) want would be to add options to `unregister()` that allow immediately stopping any new events being sent to the service worker (even for already opened clients) and then terminating all associated workers (and their associated tasks) with some time guarantee. For instance:

```
// Immediately stop sending events to the service worker, all workers will be completely gone within 10 seconds.
navigator.serviceWorker.unregister({
  unclaim: true,
  terminateDeadline: 10000
});
```

I believe "unregister" is simpler, because it doesn't have to deal with transitioning events to another worker, which is needed if the active worker is terminated and there's a waiting/installed worker.

-- 
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/1303#issuecomment-434513827

Received on Tuesday, 30 October 2018 23:59:34 UTC