Created
July 27, 2017 06:31
-
-
Save deanhume/e5b8e0af6fad706bc04a04c0377efdf1 to your computer and use it in GitHub Desktop.
Workbox Caching Example
This file contains hidden or 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
importScripts('workbox-sw.prod.v1.1.0.js'); | |
const workboxSW = new self.WorkboxSW(); | |
workboxSW.precache(fileManifest); | |
// The route for any requests from the googleapis origin | |
workboxSW.router.registerRoute('https://fonts.googleapis.com/(.*)', | |
workboxSW.strategies.cacheFirst({ | |
cacheName: 'googleapis', | |
cacheableResponse: { | |
statuses: [0, 200] | |
}, | |
networkTimeoutSeconds: 4 | |
}) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment