summaryrefslogtreecommitdiffstats
path: root/assets/js/app.js.bvr
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/app.js.bvr')
-rw-r--r--assets/js/app.js.bvr26
1 files changed, 16 insertions, 10 deletions
diff --git a/assets/js/app.js.bvr b/assets/js/app.js.bvr
index 9bddb31..3d4cc6b 100644
--- a/assets/js/app.js.bvr
+++ b/assets/js/app.js.bvr
@@ -55,7 +55,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",
@@ -103,16 +103,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);
}); \ No newline at end of file