-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsw.js
More file actions
38 lines (35 loc) · 944 Bytes
/
sw.js
File metadata and controls
38 lines (35 loc) · 944 Bytes
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
var cacheName = 'guide-pubg';
var filesToCache = [
'/pwa/',
'/pwa/index.html',
'/pwa/intro.html',
'/pwa/control.html',
'/pwa/css/style.css',
'/pwa/js/main.js',
'/pwa/js/install.js',
'/pwa/images/index/bg_battleground_v3.jpg',
'/pwa/images/index/btn_intro.png',
'/pwa/images/index/img_intro_m_v2.png',
'/pwa/images/index/img_logo_v2.jpg',
'/pwa/images/intro/img_page.jpg',
'/pwa/images/intro/intro1.jpg',
'/pwa/images/intro/intro2.jpg',
'/pwa/images/control/control1.png',
'/pwa/images/control/control2.PNG'
];
self.addEventListener('install', function(e){
console.log("install");
e.waitUntil(
caches.open(cacheName).then(function(cache){
return cache.addAll(filesToCache);
})
);
});
self.addEventListener('fetch', function(e){
console.log("fetch", e);
e.respondWith(
caches.match(e.request).then(function(response){
return response || fetch(e.request);
})
);
});