forked from nisrulz/app-privacy-policy-generator
-
Notifications
You must be signed in to change notification settings - Fork 10
/
sw.js
14 lines (12 loc) · 520 Bytes
/
sw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
importScripts(
'https://storage.googleapis.com/workbox-cdn/releases/6.4.1/workbox-sw.js'
);
// This will trigger the importScripts() for workbox.strategies and its dependencies:
workbox.loadModule('workbox-strategies');
self.addEventListener('fetch', event => {
if (event.request.url.endsWith('.svg', '.png')) {
// Referencing workbox.strategies will now work as expected.
const cacheFirst = new workbox.strategies.CacheFirst();
event.respondWith(cacheFirst.handle({ request: event.request }));
}
});