diff options
author | sijanec <sijanecantonluka@gmail.com> | 2020-06-09 12:03:06 +0200 |
---|---|---|
committer | sijanec <sijanecantonluka@gmail.com> | 2020-06-09 12:03:06 +0200 |
commit | 5fd015d56db69193baead6d7ae6a23f763d3dc58 (patch) | |
tree | b35432816a25942e99274097a9783179f7102d38 /dist/js | |
parent | code editor auto indentation fucked up bvr comments #2 (diff) | |
download | beziapp-5fd015d56db69193baead6d7ae6a23f763d3dc58.tar beziapp-5fd015d56db69193baead6d7ae6a23f763d3dc58.tar.gz beziapp-5fd015d56db69193baead6d7ae6a23f763d3dc58.tar.bz2 beziapp-5fd015d56db69193baead6d7ae6a23f763d3dc58.tar.lz beziapp-5fd015d56db69193baead6d7ae6a23f763d3dc58.tar.xz beziapp-5fd015d56db69193baead6d7ae6a23f763d3dc58.tar.zst beziapp-5fd015d56db69193baead6d7ae6a23f763d3dc58.zip |
Diffstat (limited to 'dist/js')
-rwxr-xr-x | dist/js/app.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/dist/js/app.js b/dist/js/app.js index dbd5dcf..01cf9e4 100755 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -3,7 +3,7 @@ const app_version = "1.0.14.3-beta"; -const previous_commit = "84aae4ca1449c2cee942a49a0721e5b615f2a0c2"; +const previous_commit = "170e5d4b3a65adf8cfd85acb636aa91cf9d6af0c"; const BEZIAPP_UPDATE_INTERVAL = 300; // update vsakih 300 sekund if ("serviceWorker" in navigator) { @@ -58,7 +58,7 @@ function gsecErrorHandlerUI(err) { var update_app_function = async function () { try { - $.get("/cache_name.txt?cache_kill="+Date.now(), (data, status) => { + $.get("/cache_name.txt?cache_kill=" + Date.now(), (data, status) => { var cache_name = data.split("///")[1].split("|||")[0]; var data_to_send = { action: "checkversion", @@ -106,16 +106,22 @@ var error_report_function = async function (msg, url, lineNo, columnNo, error) { window.onerror = error_report_function; window.onunhandledrejection = error_report_function; +async function try_app_update() { + localforage.getItem("lastUpdate").then((data) => { + if (Math.floor(Date.now() / 1000) > Number(data) + BEZIAPP_UPDATE_INTERVAL) { + // trigger an update + localforage.setItem("lastUpdate", Math.floor(Date.now() / 1000)).then(() => { + update_app_function(); + }); + } + }); +} document.addEventListener("DOMContentLoaded", () => { - var update_interval = setInterval(() => { // ok, it's value is never read, so what?! - localforage.getItem("lastUpdate").then((data) => { - if (Math.floor(Date.now() / 1000) > Number(data) + BEZIAPP_UPDATE_INTERVAL) { - // trigger an update - localforage.setItem("lastUpdate", Math.floor(Date.now() / 1000)) .then(()=>{ - update_app_function(); - }); - } - }); + try_app_update(); + var update_interval = setInterval(() => { + + try_app_update(); + }, 1000 * BEZIAPP_UPDATE_INTERVAL); }) |