2

I am using sw-toolbox to cache all the resources. However, I am not able to figure out how to cache api response data. I could use indexDb or internal storage for the same. Just curious to know, can I just cache it using service worker?

I tried using the below code but it didn't work.

importScripts('bower_components/sw-toolbox/sw-toolbox.js'); 
toolbox.options.debug = true;

toolbox.precache(['/','/main.js',
               '/main.css']);

toolbox.router.get('/', toolbox.fastest);
toolbox.router.get(/googleapis/, toolbox.fastest);
toolbox.router.get(/firebaseio/, toolbox.fastest);

So my fonts and Images are getting cached which hit the url googleapis, however request goes to firebaseio doesn't seem to work. Is it possible to achieve what I am doing here?

scripter
  • 1,416
  • 4
  • 19
  • 35

0 Answers0