-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathsw.js
66 lines (64 loc) · 2.06 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const cacheName = 'covid-kids-cache-v1';
const resourcesToPrecache = [
'/',
'/assets/articles/activities-list.html',
'/assets/articles/book-list.html',
'/assets/articles/discover-camp.html',
'/assets/articles/kids-corona-experience.html',
'/assets/articles/movie-list.html',
'/assets/articles/online-course.html',
'/assets/articles/planning-summer.html',
'/assets/articles/playdates-safe.html',
'/assets/articles/photo-schedule.html',
'https://api.covid19api.com/world/total',
'https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js',
'/index.html',
'/videos.html',
'/feedback.html',
'/credits.html',
'/artwork.html',
'/articles.html',
'/404.html',
'/assets/artwork/0/0.jpg',
'/assets/artwork/0/1.jpg',
'/assets/artwork/0/2.jpg',
'/assets/artwork/0/3.jpg',
'/assets/artwork/0/4.jpg',
'/assets/artwork/0/5.jpg',
'/assets/images/photo-schedule.png',
'/assets/images/book-list.jpg',
'/assets/images/camera.jpg',
'/assets/images/corona.png',
'/assets/images/course-site.png',
'/assets/images/dc.jpeg',
'/assets/images/puzzle.jpg',
'/assets/images/summer-plan.png',
'/assets/images/playdate.jpeg',
'/assets/js/main.js',
'/assets/js/articles.js',
'/assets/js/bootstrap.min.js',
'/assets/js/bootstrap.min.js.map',
'/assets/js/jquery.min.js',
'/assets/includes/head.js',
'/assets/includes/static-article.head.js',
'/assets/includes/header.js',
'/assets/includes/static-article-header.js',
'/assets/fonts/BebasNeue-Bold.ttf',
'/assets/css/styles.css'
];
self.addEventListener('install', event => {
console.log('Service Worker Install Event');
event.waitUntil(
caches.open(cacheName)
.then(cache => {
return cache.addAll(resourcesToPrecache);
})
);
});
self.addEventListener('fetch', event => {
event.respondWith(caches.match(event.request)
.then(cachedResponce => {
return cachedResponce || fetch(event.request);
})
);
});