-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathserviceworker.js
57 lines (54 loc) · 1.35 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict';
var CACHE_NAME = 'DirtyLittleSQL';
var urlsToCache = [
'sql-wasm.wasm',
'separators-pre.js',
'worker.sql-wasm.js',
'serviceworker.js',
'tips.js',
'3rdparty/json2csv.js',
'3rdparty/chart.min.js',
'3rdparty/localforage.min.js',
'3rdparty/hotkeys.min.js',
'3rdparty/xlsx.full.min.js',
'3rdparty/codemirror/show-hint.js',
'3rdparty/codemirror/sql-hint.js',
'3rdparty/codemirror/sql.min.js',
'3rdparty/codemirror/codemirror.js',
'gui.js',
'separators.js',
'index.html',
'3rdparty/codemirror/3024-night.css',
'3rdparty/codemirror/3024-day.css',
'3rdparty/codemirror/show-hint.css',
'3rdparty/codemirror/codemirror.css',
'fonts.css',
'demo.css',
'ABCFavoritMono-Regular.woff',
'ABCFavoritMono-Light.woff2',
'ABCFavoritMono-Light.woff',
'ABCFavoritMono-Regular.woff2',
];
self.addEventListener('install', function(event) {
// Perform install steps
event.waitUntil(
caches.open(CACHE_NAME)
.then(function(cache) {
console.log('Opened cache');
return cache.addAll(urlsToCache);
})
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request)
.then(function(response) {
// Cache hit - return response
if (response) {
return response;
}
return fetch(event.request);
}
)
);
});