diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2018-01-20 22:27:21 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-20 22:27:21 +0530 |
commit | 20e5d052155112578d298f64ca49c5c31d13b6aa (patch) | |
tree | f454f9282b931a5ff20ddfb9ee35a7e590cf48de /sw.js | |
parent | 91bb4b075bb4f5c6211def101c73479db0acbb01 (diff) |
Update sw.js
Diffstat (limited to 'sw.js')
-rw-r--r-- | sw.js | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -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); + }) + ); }); |