-
Notifications
You must be signed in to change notification settings - Fork 1
/
sw.js
85 lines (80 loc) · 3.52 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var STATIC_CACHE = 'static-cache-v2'
// listen for outgoing network request
self.addEventListener('fetch', function(event) {
// try to find response object in the cache
// associated with current request
event.respondWith(
caches.open(STATIC_CACHE).then(function (cache) {
return cache.match(event.request).then(function (response) {
if (response) return response;
return fetch(event.request).then(function (networkResponse) {
return networkResponse;
});
});
})
);
});
self.addEventListener('activate', function (event) {
console.log('service worker activate');
var cacheWhitelist = [STATIC_CACHE];
event.waitUntil(
caches.keys().then(function (keyList) {
return Promise.all(keyList.map(function (key) {
if (cacheWhitelist.indexOf(key) === -1) {
return caches.delete(key);
}
}));
})
);
});
self.addEventListener('install', function (event) {
event.waitUntil(
caches.open(STATIC_CACHE).then(function (cache) {
return cache.addAll(
[
"./",
"./index.html",
"./css/lib/onsen/css/onsenui.min.css",
"./css/lib/onsen/css/onsen-css-components.min.css",
"./css/style.min.css",
"./cordova.js",
"./js/app.min.js",
"https://cdn.polyfill.io/v2/polyfill.min.js",
"./manifest.json",
"./css/lib/onsen/css/ionicons/css/ionicons.min.css",
"./css/lib/onsen/css/material-design-iconic-font/css/material-design-iconic-font.min.css",
"./css/lib/onsen/css/font_awesome/css/font-awesome.min.css",
"./cordova_plugins.js",
"./plugins/cordova-plugin-admobpro/www/AdMob.js",
"./plugins/cordova-plugin-device/www/device.js",
"./plugins/cordova-plugin-device/src/browser/DeviceProxy.js",
"./plugins/cordova-plugin-dialogs/www/notification.js",
"./plugins/cordova-plugin-dialogs/www/browser/notification.js",
"./data/gemeente-codes.json",
"./views/splitter.html",
"./images/meta-icons/favicon-32x32.png",
"./images/meta-icons/android-chrome-144x144.png",
"./js/browser.js",
"./images/meta-icons/favicon-16x16.png",
"./views/map.html",
"./views/map.html",
"./images/meta-icons/android-chrome-192x192.png",
"./css/lib/onsen/css/material-design-iconic-font/fonts/Material-Design-Iconic-Font.woff2",
"./views/about.html",
"./images/screenshot1.png",
"./images/screenshot2.png",
"./images/screenshot3.png",
"./images/screenshot4.png",
"./images/screenshot5.png",
"./views/search.html",
"./views/details.html",
"./views/details-general.html",
"./views/details-panden.html",
"./views/details-verblijfplaatsen.html",
"./views/details-misc.html",
"./views/details-verblijfobject-detail.html"
]
);
})
);
});