summaryrefslogtreecommitdiff
path: root/worker.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-11-23 15:10:35 +0300
committerAndrew Dolgov <[email protected]>2018-11-23 15:10:35 +0300
commit35d9cc340c923b1cd7ec2226980191a0402ddf5a (patch)
tree669ea93436029bd370578082d9c7dde1fd165151 /worker.js
parentb9a0f230aeae4e8e1ea6978c164cc6cf66424fa2 (diff)
worker: implement cache-busting for forced refreshes; remove leftover includes of qtip2
Diffstat (limited to 'worker.js')
-rw-r--r--worker.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/worker.js b/worker.js
index 2450407..a18b34c 100644
--- a/worker.js
+++ b/worker.js
@@ -3,6 +3,8 @@
const CACHE_PREFIX = 'epube';
const CACHE_NAME = CACHE_PREFIX + '-v2';
const CACHE_URLS = [
+ 'img/favicon_hires.png',
+ 'img/favicon.png',
'read.html',
'js/common.js',
'js/read.js',
@@ -79,15 +81,18 @@ self.addEventListener('message', function(event){
if (CACHE_URLS[i].match("backend.php"))
continue;
- //console.log(CACHE_URLS[i]);
+ var fetch_url = CACHE_URLS[i] + "?ts=" + Date.now();
- var promise = fetch(CACHE_URLS[i]).then(function(resp) {
- //console.log(resp);
+ var promise = fetch(fetch_url).then(function(resp) {
+ var url = new URL(resp.url);
+ url.searchParams.delete("ts");
+
+ console.log('got', url);
if (resp.status == 200) {
- cache.put(resp.url, resp);
+ cache.put(url, resp);
} else if (resp.status == 404) {
- cache.delete(resp.url);
+ cache.delete(url);
}
});