-
Notifications
You must be signed in to change notification settings - Fork 0
/
sw.js
30 lines (29 loc) · 803 Bytes
/
sw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
self.addEventListener('install', function(event){
// caching all static files
event.waitUntil(
caches.open('static').then(function(cache){
return cache.addAll([
// lib
'/axios.min.js',
'/vue.min.js',
'/lodash.min.js',
'/mousetrap.min.js',
'de.svg',
'en.svg',
'fr.svg',
'es.svg',
'pl.svg',
'it.svg',
'ru.svg',
'se.svg'
]);
})
);
});
self.addEventListener('fetch', function(event){
event.respondWith(
caches.match(event.request).then(function(response){
return response || fetch(event.request);
})
);
});