From 20e5d052155112578d298f64ca49c5c31d13b6aa Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sat, 20 Jan 2018 22:27:21 +0530 Subject: Update sw.js --- sw.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'sw.js') diff --git a/sw.js b/sw.js index 8976e07..8865b80 100644 --- a/sw.js +++ b/sw.js @@ -12,8 +12,27 @@ // See the License for the specific language governing permissions and // limitations under the License. -/** An empty service worker! */ + +self.addEventListener('install', function(e) { + e.waitUntil( + caches.open('your-magic-cache').then(function(cache) { + return cache.addAll([ + '/', + '/index.html', + '/Contact.html', + '/404.html', + '/css/*', + '/js/*', + '/mjolnir/*', + ]); + }) + ); +}); self.addEventListener('fetch', function(event) { - /** An empty fetch handler! */ + event.respondWith( + caches.match(event.request).then(function(response) { + return response || fetch(event.request); + }) + ); }); -- cgit v1.2.3