This commit is contained in:
William Blythe
2018-10-23 12:41:56 +11:00
parent a2ab708ac9
commit 7d99471f89

View File

@@ -16,24 +16,7 @@ if (workbox) {
] ]
}) })
); );
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
})
]
})
);
workbox.routing.registerRoute(
/\.(?:js|css)$/,
workbox.strategies.staleWhileRevalidate({
cacheName: 'static-resources'
})
);
try { try {
workbox.googleAnalytics.initialize(); workbox.googleAnalytics.initialize();
} catch (e) { } catch (e) {
@@ -43,7 +26,6 @@ if (workbox) {
console.log('Boo! Workbox didn\'t load 😬'); console.log('Boo! Workbox didn\'t load 😬');
} }
self.addEventListener('message', event => { self.addEventListener('message', event => {
if (!event.data) { if (!event.data) {
return; return;