From aac477636e46ac9d9f30628f5995a70d7ab28c83 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 21 Jan 2018 18:13:27 +0530 Subject: Create sw.js --- sw.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sw.js diff --git a/sw.js b/sw.js new file mode 100644 index 0000000..8a4bd47 --- /dev/null +++ b/sw.js @@ -0,0 +1,18 @@ +// sw.js +self.addEventListener('install', e => { + e.waitUntil( + // after the service worker is installed, + // open a new cache + caches.open('my-pwa-cache').then(cache => { + // add all URLs of resources we want to cache + return cache.addAll([ + '/', + '/index.html', + '/about.html', + '/images/doggo.jpg', + '/styles/main.min.css', + '/scripts/main.min.js', + ]); + }) + ); +}); -- cgit v1.2.3