svg.escobar.life

A simple SVG markup editor for the web

service-worker.js (496B)

 1 self.addEventListener('install', installHandler);
 2 self.addEventListener('fetch', fetchHandler);
 3 
 4 function installHandler(e) {
 5     e.waitUntil(
 6         caches.open('progressive-elm')
 7             .then((cache) => cache.addAll(['/', '/index.html']))
 8             .catch(console.error)
 9     );
10 }
11 
12 function fetchHandler(e) {
13     e.respondWith(
14         caches.match(event.request)
15             .then((response) => response || fetch(e.request))
16             .catch(console.error)
17     );
18 }