Re: [w3c/ServiceWorker] Allow active worker to immediately evict itself (#1296)

@jakearchibald 
> I'm going on the assumption that 'evict' means "any client controlled by this service worker becomes uncontrolled"

Sort of. The original intent of this issue is now partly covered by CSD, although I think some additional supporting features may be necessary (gonna post another issue shortly).

The use case that I believe could use work is when the active worker (or the client) expects there to be a newer version and wants to initiate a "forced/manual" activation that newer version.

For example let's say you wanted to implement feature flags in a service worker by embedding some boolean flags in the service worker script. And lets say your service worker normally doesn't use skipWaiting(). But if there's an "on" flag in a worker that you want to turn off, you want the "off" state to activate immediately. One way to implement this is to have the service worker check a heartbeat endpoint and send the current flag state. The server could use CSD when the flag state sent by the service worker is invalid, but this is a little heavy handed. Instead, I think we should allow the active worker to simply declare that the registration should either activate to the latest (if it exists) or gracefully evict the current worker until a new version is available.

-- 
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/1296#issuecomment-531539851

Received on Sunday, 15 September 2019 06:50:55 UTC