Re: [slightlyoff/ServiceWorker] Enabling multiple Service Workers for a single scope (#921)

> How do you do this without asking your clients to change their site? Do you inject a script at the CDN level?

Yeah. Or add a `<link rel=service-worker>` or an equivalent header.

> As far as I can tell, this proposal seems to be based on the belief that it's easier for sites/optimization services to drop in a new <script> tag to register a second service worker, than it is for those same sites/optimization services to drop in a new importScripts() call to work within the existing service worker? 

Not at all. If an `importScripts()` call (or any other call) could have solved the same use case, I'd be thrilled.

The problem with the current `importScripts()` approach is that multiple fetch events that register have no guaranty regarding ordering and the first one of them that calls `respondWith` wins. There's no real way to chain requests going "down" and responses going "up", without restructuring the SWs to work as plugins in a framework (e.g. middleware in ServiceWorkerWare). 



---
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/921#issuecomment-229685951

Received on Thursday, 30 June 2016 15:41:22 UTC