-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathog-sw.js
30 lines (28 loc) · 768 Bytes
/
og-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
// Install and activate the service worker
self.addEventListener('install', function(event) {
console.log('SW installing...');
event.waitUntil(
caches.open('soundboard-cache-v1').then(function(cache) {
return cache.addAll([
'/',
'index.html',
'css/styles.css',
'css/spinner.css',
'img/mlg-favicon.png',
'loader.js',
'sounds.json'
]);
})
);
});
self.addEventListener('activate', function(event) {
console.log('SW activating...');
});
// Intercept network requests and return cached responses
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request);
})
);
});