-
Notifications
You must be signed in to change notification settings - Fork 0
/
sw.js
34 lines (32 loc) · 771 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
31
32
33
34
var fileList=[
"sw.js",
"index.html",
"manifest.json",
"assets/css/gcube.css",
"assets/css/style.css",
"assets/js/script.js",
"assets/lib/jquery.min.js",
"assets/lib/gcube.js",
"assets/images/logo-512.png",
"assets/images/logo-128.png",
"assets/images/full.svg",
"assets/images/moon.png"
];
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open('sw-cache').then(function(cache) {
var files;
for(i=0;i<=fileList.length;i++){
files += + cache.add(fileList[i]);
}
return files;
})
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request);
})
);
});