I'd like to use two service workers on my site: one to provide a classic offline cache (/sw.js
) for my PWA and another for something like a local database "server" which uses background sync and push (/sw-db.js
). Since the latter tends to do heavy work (blocking the event loop for a few ms) it's better to keep it separate.
Since the database sw is not used for fetch requests, I would give it a dummy scope, whereas sw.js
is scoped for the whole domain.
Does the first, which responds to "fetch" events, also serve the code/URL for /sw-db.js
(keeping it somewhat in-sync with site updates) or are service workers always updated via network.