diff options
Diffstat (limited to 'js/inknswitch/sw.js')
-rw-r--r-- | js/inknswitch/sw.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/js/inknswitch/sw.js b/js/inknswitch/sw.js new file mode 100644 index 0000000..052c0a4 --- /dev/null +++ b/js/inknswitch/sw.js @@ -0,0 +1,19 @@ +self.addEventListener('install', function(event) { + event.waitUntil( + caches.open('inknswitch').then(function(cache) { + return cache.addAll([ + './index.html', + './ink.js', + './icon.png' + ]); + }) + ); + }); + + self.addEventListener('fetch', function(event) { + event.respondWith( + caches.match(event.request).then(function(response) { + return response || fetch(event.request); + }) + ); + }); \ No newline at end of file |