summaryrefslogtreecommitdiff
path: root/worker.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-02-26 13:12:33 +0300
committerAndrew Dolgov <[email protected]>2017-02-26 13:12:33 +0300
commite01f57a3d98943954372110dc75e8d731fbacc10 (patch)
tree2d57e3a2368984f03507f2650f0b94273dced625 /worker.js
parentb8ae4b31c129031e89e4c7fb9801d6761513dd73 (diff)
further offline improvements
Diffstat (limited to 'worker.js')
-rw-r--r--worker.js29
1 files changed, 5 insertions, 24 deletions
diff --git a/worker.js b/worker.js
index 2ef4b9c..e2413a4 100644
--- a/worker.js
+++ b/worker.js
@@ -1,10 +1,13 @@
-var CACHE_NAME = 'epube-test';
+//importScripts('lib/localforage.min.js');
+
+var CACHE_NAME = 'epube-v1';
self.addEventListener('activate', function(event) {
event.waitUntil(
caches.open(CACHE_NAME).then(function(cache) {
var urls = [
'read.html',
+ 'js/common.js',
'js/read.js',
'js/offline.js',
'css/read.css',
@@ -35,8 +38,6 @@ this.addEventListener('fetch', function(event) {
if (resp) return resp;
- console.log(req.url);
-
if (req.url.match("read.html")) {
return caches.match("read.html");
}
@@ -46,27 +47,7 @@ this.addEventListener('fetch', function(event) {
}
}
- return fetch(req)
- .then(function(resp) {
-
- if (req.url.match(/(getlastread|getpagination|\.epub)/)) {
- caches.open(CACHE_NAME).then(function(cache) {
- cache.put(event.request, resp.clone());
- });
- } /*else {
- caches.match(req.url).then(function(cached) {
- if (cached) {
- console.log('refreshing ' + req.url);
-
- caches.open(CACHE_NAME).then(function(cache) {
- cache.put(event.request, resp.clone());
- });
- }
- });
- } */
-
- return resp.clone();
- });
+ return fetch(req);
})
);
});