diff options
author | Andrew Dolgov <[email protected]> | 2017-02-26 15:15:21 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-02-26 15:15:21 +0300 |
commit | f236b1f9a7b3a984fd539013ba32d93a90e17c2d (patch) | |
tree | def00f6e8576b98b82d32ac656127432003833a0 | |
parent | b8c68ed431e55ac8ceea1046dd7af94495b1ac90 (diff) |
worker: add missing css; only handle requests when offline
-rw-r--r-- | worker.js | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -11,6 +11,7 @@ self.addEventListener('activate', function(event) { 'js/read.js', 'js/offline.js', 'css/read.css', + 'css/index.css', 'offline.html', 'lib/zip.min.js', 'lib/epub.js', @@ -32,9 +33,9 @@ self.addEventListener('activate', function(event) { this.addEventListener('fetch', function(event) { var req = event.request.clone(); - event.respondWith( - caches.match(req).then(function(resp) { - if (!navigator.onLine) { + if (!navigator.onLine) { + event.respondWith( + caches.match(req).then(function(resp) { if (resp) return resp; @@ -45,9 +46,7 @@ this.addEventListener('fetch', function(event) { if (req.url.match("index.php")) { return caches.match("offline.html"); } - } - - return fetch(req); - }) - ); + }) + ); + } }); |