-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsw.js
45 lines (41 loc) · 1.18 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
"use strict";
const CACHE_NAME = "cache-v0.6";
const CACHED_URLS = [
"/",
"/index.html",
"/manifest.json",
"/assets/js/script.js",
"/assets/css/reset.css",
"/assets/css/style.css",
"/assets/css/style.css.map",
"/assets/css/style.scss",
"/assets/js/reader.js",
"/assets/js/data.js",
"/assets/fonts/SF-Pro-Text-Regular.otf",
"/assets/images/add-race.png",
"/assets/images/back.png",
"/assets/images/burger.png",
"/assets/images/comments.png",
"/assets/images/create-post.png",
"/assets/images/delete.png",
"/assets/images/f1storieslogo.png",
"/assets/images/liked.png",
"/assets/images/notliked.png",
"/assets/images/open-settings.png",
"/assets/images/share.png",
"/assets/images/view-profile.png"
]
self.addEventListener("install",function(e){
e.waitUntil(
caches.open(CACHE_NAME).then(cache => {
return cache.addAll(CACHED_URLS)
})
)
})
self.addEventListener("fetch",function(e){
e.respondWith(caches.open(CACHE_NAME).then(cache =>{
return cache.match(e.request).then(cacheResponse => {
return cacheResponse || fetch(e.request);
});
}))
})