Service Workers & Progressive Web Apps
What is the purpose of workbox in PWA development?
importScripts('https://storage.googleapis.com/workbox-cdn/releases/6.x/workbox-sw.js');
workbox.routing.registerRoute(
({request}) => request.destination === 'image',
new workbox.strategies.CacheFirst({
cacheName: 'images',
plugins: [
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60
})
]
})
);