Created
June 11, 2018 15:17
-
-
Save manolinux/85bb94889c00108e4abc2994330be578 to your computer and use it in GitHub Desktop.
Caching service worker
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
// Your code here... | |
workbox.routing.registerRoute( | |
/\.(?:png|gif|jpg|jpeg|svg)$/, | |
workbox.strategies.cacheFirst({ | |
cacheName: 'images', | |
plugins: [ | |
new workbox.expiration.Plugin({ | |
maxEntries: 60, | |
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days | |
}), | |
], | |
}), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment