Created
April 25, 2016 02:34
-
-
Save caraya/70f93f12b1588cd8f48a721136b8164d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global => { | |
'use strict'; | |
// Load the sw-toolbox library. | |
importScripts('bower_components/sw-toolbox/sw-toolbox.js'); | |
// Turn on debug logging, visible in the Developer Tools' console. | |
global.toolbox.options.debug = true; | |
// By default, all requests will use the toolbox.networkFirst cache | |
// strategy, and their responses will be stored in the default cache. | |
global.toolbox.router.default = global.toolbox.networkFirst; | |
// Boilerplate to ensure our service worker takes control of the page as soon | |
// as possible. | |
global.addEventListener('install', | |
event => event.waitUntil(global.skipWaiting())); | |
global.addEventListener('activate', | |
event => event.waitUntil(global.clients.claim())); | |
})(self); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment