diff options
author | altaf-creator <64111012+altaf-creator@users.noreply.github.com> | 2023-05-05 08:42:54 +0700 |
---|---|---|
committer | altaf-creator <64111012+altaf-creator@users.noreply.github.com> | 2023-05-05 08:42:54 +0700 |
commit | d152ffac9147986b25542bcf78561e183ae83eb3 (patch) | |
tree | 27032fe0d92821721f63de6d8040edab2602275f /src/scripts/main.js | |
parent | 5725accf76d1ec02d569c59a9989b7d72827a7ee (diff) |
PWA Update - final i hope
Diffstat (limited to 'src/scripts/main.js')
-rw-r--r-- | src/scripts/main.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/scripts/main.js b/src/scripts/main.js index c610e83..96210b1 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -8,13 +8,17 @@ function urlExists(url) { if ("serviceWorker" in navigator) { window.addEventListener("load", function () { - for (var i = 0; i < assets.length; i++) { - urlExists(assets[i]); - } + try { + process.versions['electron']; + } catch { + for (var i = 0; i < assets.length; i++) { + urlExists(assets[i]); + } - navigator.serviceWorker - .register("scripts/service-worker.js") - .then(res => console.log("service worker registered")) - .catch(err => console.log("service worker not registered", err)) + navigator.serviceWorker + .register("scripts/service-worker.js") + .then(res => console.log("service worker registered")) + .catch(err => console.log("service worker not registered", err)) + } }) }
\ No newline at end of file |