summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraltaf-creator <64111012+altaf-creator@users.noreply.github.com>2023-05-04 20:19:01 +0700
committeraltaf-creator <64111012+altaf-creator@users.noreply.github.com>2023-05-04 20:19:01 +0700
commit4898f6889e7b4ab39f04c152e17ac4ca763ff975 (patch)
tree9db55d98d4cc6771ff222af25e74beb2b092e1de /src
parent04f941b9fb332103a8b3653a480b567577b421e0 (diff)
PWA Update - attempt 4.1 | it doesn't work :(
Diffstat (limited to 'src')
-rw-r--r--src/scripts/service-worker.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/scripts/service-worker.js b/src/scripts/service-worker.js
index e2c291c..38cffd5 100644
--- a/src/scripts/service-worker.js
+++ b/src/scripts/service-worker.js
@@ -23,10 +23,22 @@ const assets = [
"../src/scripts/sura-list.js",
];
+function urlExists(url) {
+ var http = new XMLHttpRequest();
+ http.open('HEAD', url, false);
+ if (http.status != 200)
+ console.log(url)
+ http.send();
+ return http.status != 404;
+}
+
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(staticQuran).then(cache => {
cache.addAll(assets)
+ for (var i = 0; i < assets.length; i++) {
+ urlExists(assets[i]);
+ }
console.log(assets)
})
)