-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathA2HS_ServiceWorker.js
39 lines (37 loc) · 1.32 KB
/
A2HS_ServiceWorker.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
var cacheName = 'v:static';
self.addEventListener('install', function (e) {
e.waitUntil(
caches.open(cacheName).then(function (cache) {
return cache.addAll([
'index.html',
'Help.html',
'images/Buerkert_Logo.png',
'icon/Facebook.png',
'icon/GooglePlus.png',
'icon/LinkedIn.png',
'icon/Twitter.png',
'icon/Xing.png',
'icon/Youtube.png',
'StyleSheet.css',
'Page1Logic.js',
'Bluetooth_Transfer_Protobuf.js',
'protobuf/protobuf.js',
'QR-Scanner/instascan.min.js',
'QR-Scanner/QR-Scanner.js'
]).then(function (cache) {
self.skipWaiting();
});
})
);
});
self.addEventListener('fetch', function (e) {
console.log(e.request.url);
e.respondWith(
caches.match(e.request).then(function (response) { // Versucht Antwort vom cache zu erhalten
if (response) {
return response; // Gibt Antwort zurück
}
return fetch(e.request); // Gibt die Anfrage zurück
})
);
});