My case is this: I have created a npm package do all the cache related work, and I employed service worker in this npm package. My question is: how to make service worker available to the root domain(i.e the application root)?
Asked
Active
Viewed 43 times
0
-
Possible duplicate of [Understanding Service Worker scope](https://stackoverflow.com/questions/35780397/understanding-service-worker-scope) – Jeff Posnick Dec 08 '17 at 15:47
-
You would importScripts the url of your script. In all honesty you should abstract your logic into scripts you can import. Make your actual service worker code pretty skeleton. Abstracting the logic into separate classes gives you the ability to test and reuse it easier. – Chris Love Dec 09 '17 at 01:39