aboutsummaryrefslogtreecommitdiffhomepage
path: root/worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'worker.js')
-rw-r--r--worker.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/worker.js b/worker.js
new file mode 100644
index 0000000..511c35a
--- /dev/null
+++ b/worker.js
@@ -0,0 +1,32 @@
1self.addEventListener('install', event => {
2 event.waitUntil(
3 caches
4 .open('homer')
5 .then(cache =>
6 cache.addAll([
7 '/',
8 '/index.html',
9 '/config.yml',
10 '/app.css',
11 '/app.js',
12 '/vendors/js-yaml.min.js',
13 '/assets/logo.png',
14 'https://use.fontawesome.com/releases/v5.5.0/css/all.css',
15 'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
16 'https://fonts.googleapis.com/css?family=Lato|Raleway',
17 'https://cdn.jsdelivr.net/npm/vue@2.6.2/dist/vue.min.js',
18 ])
19 )
20 )
21})
22
23self.addEventListener('fetch', event => {
24 event.respondWith(
25 caches.match(event.request).then(response => {
26 if (response) {
27 return response;
28 }
29 return fetch(event.request);
30 })
31 );
32});