Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Caches all requests ending in .html
- * Handle those requests using a network-first strategy.
- */
- workboxSW.router.registerRoute(
- /\.html$/,
- workboxSW.strategies.networkFirst( [] )
- );
- /* The setup cache has a maximum size of 20 images,
- * and once that's reached, the least-recently used entry will be deleted.
- * Additionally, any entries older than 1 week will be deleted. */
- workboxSW.router.registerRoute(
- '/images/(.*)',
- workboxSW.strategies.cacheFirst({
- cacheName: 'images',
- cacheExpiration: {
- maxEntries: 20,
- maxAgeSeconds: 7 * 24 * 60 * 60,
- },
- cacheableResponse: {statuses: [0, 200]},
- })
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement