diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2018-01-21 18:13:27 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-21 18:13:27 +0530 |
commit | aac477636e46ac9d9f30628f5995a70d7ab28c83 (patch) | |
tree | 6cc8a6fd1f51f4d3c5122e3087ce310a6a09ac4a /sw.js | |
parent | 6aba7f9b4a6b8d88bce9b0186aede5dd4e31d4e8 (diff) |
Create sw.js
Diffstat (limited to 'sw.js')
-rw-r--r-- | sw.js | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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', + ]); + }) + ); +}); |