-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsw.js
30 lines (29 loc) · 983 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
this.addEventListener('install', function(event) {
event.waitUntil(
caches.open('v1').then(function(cache) {
return cache.addAll([
'/',
'/sw.js',
'/libs/vendor/bootstrap/dist/css/bootstrap.min.css',
'/libs/vendor/bootstrap/dist/css/bootstrap-theme.min.css',
'/libs/vendor/moment/min/moment.min.js',
'/libs/vendor/handlebars/handlebars.min.js',
'/libs/vendor/jquery/dist/jquery.min.js',
'/libs/vendor/bootstrap/dist/js/bootstrap.min.js',
'/libs/js/timetracker.js'
]);
})
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request)
.then(function(response) {
if (response) {
return response;
}
return fetch(event.request);
}
)
);
});