Skip to content

Instantly share code, notes, and snippets.

@thangman22
Created July 22, 2016 05:31
Show Gist options
  • Save thangman22/05604168225ef4f5b26224fe2b98e386 to your computer and use it in GitHub Desktop.
Save thangman22/05604168225ef4f5b26224fe2b98e386 to your computer and use it in GitHub Desktop.
importScripts('node_modules/sw-toolbox/sw-toolbox.js');
self.addEventListener('install', (event) => {
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(self.clients.claim());
});
toolbox.options.debug = true;
toolbox.precache(['index.html']);
toolbox.router.get('/', toolbox.cacheFirst);
toolbox.router.get('/(.*)', toolbox.cacheFirst, {origin: 'https://graph.facebook.com'});
toolbox.router.get('/(.*)', toolbox.cacheFirst, {origin: 'https://cdnjs.cloudflare.com/'});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment