mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
sw
This commit is contained in:
20
src/sw.js
20
src/sw.js
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user