mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-11 13:18:21 -04:00
Attempt to disable caching for cache.addAll
Former-commit-id: bd5c457edf519e98901b409e19f881cee4e746a8 [formerly ae22d6aded2d1e661260cbe82e76c08b705c3eaa] [formerly 77d10f30bd1a908ee6252ea8ebf97eb7682f2e64] [formerly 84956687daf28c18399d4e305fbc6ef00098a93f [formerly 33b6d63ab58e5c471bc59c380673aec1273fc991 [formerly a8e38cba59ed092f91d751b4c3fcead3fbe0340a]]] Former-commit-id: 90decb464dd1bda04d7eced1e0090080b640da4a [formerly f2b7ee8db841785603666360761624b305ca0d03 [formerly 928b5346036a11b85582ec854c43a4127a94d1a7]] Former-commit-id: 496867c7bc8600b6d0d61574ca049dbd15ee9440 [formerly 7897c30572f944e7c9d5de8b7ca90f213d24c2bc] Former-commit-id: 9418cc40ba60caeca5472711914f2228d1c9e22e
This commit is contained in:
parent
60a54eef02
commit
a3a28d9aac
@ -44,6 +44,7 @@ const precacheFiles = [
|
|||||||
"www/css/bootstrap.min.css",
|
"www/css/bootstrap.min.css",
|
||||||
"www/fonts/glyphicons-halflings-regular.woff2",
|
"www/fonts/glyphicons-halflings-regular.woff2",
|
||||||
"www/img/icons/kiwix-256.png",
|
"www/img/icons/kiwix-256.png",
|
||||||
|
"www/img/icons/kiwix-192.png",
|
||||||
"www/img/icons/kiwix-32.png",
|
"www/img/icons/kiwix-32.png",
|
||||||
"www/img/icons/kiwix-60.png",
|
"www/img/icons/kiwix-60.png",
|
||||||
"www/img/icons/kiwix-blue-32.png",
|
"www/img/icons/kiwix-blue-32.png",
|
||||||
@ -101,9 +102,21 @@ self.addEventListener("install", function (event) {
|
|||||||
console.log("[SW] Install Event processing");
|
console.log("[SW] Install Event processing");
|
||||||
self.skipWaiting();
|
self.skipWaiting();
|
||||||
var requests = precacheFiles.map(function(url) {
|
var requests = precacheFiles.map(function(url) {
|
||||||
return new Request(url);
|
return new Request(url, { cache: 'no-cache' });
|
||||||
});
|
});
|
||||||
if (!excludedURLSchema.test(requests[0].url)) event.waitUntil(
|
if (!excludedURLSchema.test(requests[0].url)) event.waitUntil(
|
||||||
|
// caches.open(CACHE).then(function (cache) {
|
||||||
|
// Promise.all(
|
||||||
|
// precacheFiles.map(fucntion (url) {
|
||||||
|
// // cache-bust using a random query string
|
||||||
|
// return fetch(`${url}?${Math.random()}`).then((response) => {
|
||||||
|
// // fail on 404, 500 etc
|
||||||
|
// if (!response.ok) throw Error('Not ok');
|
||||||
|
// return cache.put(url, response);
|
||||||
|
// });
|
||||||
|
// })
|
||||||
|
// );
|
||||||
|
// })
|
||||||
caches.open(CACHE).then(function (cache) {
|
caches.open(CACHE).then(function (cache) {
|
||||||
console.log("[SW] Caching pages during install");
|
console.log("[SW] Caching pages during install");
|
||||||
return cache.addAll(requests).then().catch(function(err) {
|
return cache.addAll(requests).then().catch(function(err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user