diff --git a/index.html b/index.html index be41d4a..ae9b1b4 100644 --- a/index.html +++ b/index.html @@ -19,6 +19,7 @@ }); Interval Timer + @@ -27,14 +28,13 @@ - - + - + @@ -79,5 +79,12 @@ Save Changes + diff --git a/sw.js b/sw.js new file mode 100644 index 0000000..9c7c4c9 --- /dev/null +++ b/sw.js @@ -0,0 +1,42 @@ +self.addEventListener('install', function(e) { + e.waitUntil( + caches.open('wbrawner-interval-timer').then(function(cache) { + return cache.addAll([ + '/', + '/audio/beep-10.mp3', + '/audio/beep-09.mp3', + '/audio/button-42(1).mp3', + '/css/addtohomescreen.css', + '/css/font-awesome.min.css', + '/css/styles.css', + '/fonts/fontawesome-webfont.woff', + '/fonts/FontAwesome.otf', + '/fonts/fontawesome-webfont.svg', + '/fonts/fontawesome-webfont.woff2', + '/fonts/fontawesome-webfont.ttf', + '/fonts/fontawesome-webfont.eot', + '/index.html', + '/js/start.js', + '/js/angular-cookies.min.js', + '/js/addtohomescreen.min.js', + '/js/addtohomescreen.js', + '/js/angular.min.js', + '/js/app.js', + '/sw.js' + ]); + }) + ); +}); + +self.addEventListener('fetch', function(event) { + event.respondWith( + caches.match(event.request).then(function(response) { + caches.open('wbrawner-interval-timer').then(function(cache) { + if (event.request.url.match(/^https?/)) { + cache.add(event.request.url); + } + }) + return response || fetch(event.request); + }) + ); +});