Re: [w3c/ServiceWorker] Detecting service worker termination (#1550)

`beforeTerminate` runs counter to the existing ServiceWorker design of having the worker clearly delineate what ExtendableEvents are still processing through use of `waitUntil` and is likely a non-starter.  For example, the plan is to break all web locks if a ServiceWorker does not have any active ExtendableEvents.

The SW can call both `FetchEvent.respondWith` and `FetchEvent.waitUntil`.  The respondWith can resolve in a very timely fashion like 100msec and you can spend on the order of seconds or tens of seconds continuing to perform amortized cache cleanup before resolving the promise passed to `waitUntil`.  `handled` will be resolved shortly after your `respondWith` promise resolves; its goal is to enable a ServiceWorker to avoid interfering with any on-thread processing that happens as part of consuming the Response that was received by `respondWith`.

-- 
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/1550#issuecomment-720720778

Received on Monday, 2 November 2020 20:59:14 UTC