From d152ffac9147986b25542bcf78561e183ae83eb3 Mon Sep 17 00:00:00 2001 From: altaf-creator <64111012+altaf-creator@users.noreply.github.com> Date: Fri, 5 May 2023 08:42:54 +0700 Subject: PWA Update - final i hope --- src/scripts/main.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/scripts/main.js') 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 -- cgit v1.2.3