summaryrefslogtreecommitdiffstats
path: root/assets/js/app.js.bvr
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-06-08 23:13:49 +0200
committersijanec <sijanecantonluka@gmail.com>2020-06-08 23:13:49 +0200
commit5f22473be3faa9cd2a50444f8bea4af46725c030 (patch)
tree41104848e07cc1687c291b2017cf6d38a1e63b24 /assets/js/app.js.bvr
parentuhhh, didn't even test ): (diff)
downloadbeziapp-5f22473be3faa9cd2a50444f8bea4af46725c030.tar
beziapp-5f22473be3faa9cd2a50444f8bea4af46725c030.tar.gz
beziapp-5f22473be3faa9cd2a50444f8bea4af46725c030.tar.bz2
beziapp-5f22473be3faa9cd2a50444f8bea4af46725c030.tar.lz
beziapp-5f22473be3faa9cd2a50444f8bea4af46725c030.tar.xz
beziapp-5f22473be3faa9cd2a50444f8bea4af46725c030.tar.zst
beziapp-5f22473be3faa9cd2a50444f8bea4af46725c030.zip
Diffstat (limited to 'assets/js/app.js.bvr')
-rw-r--r--assets/js/app.js.bvr34
1 files changed, 19 insertions, 15 deletions
diff --git a/assets/js/app.js.bvr b/assets/js/app.js.bvr
index 5b74aba..0bc7bcb 100644
--- a/assets/js/app.js.bvr
+++ b/assets/js/app.js.bvr
@@ -54,18 +54,22 @@ function gsecErrorHandlerUI(err) {
}
var update_app_function = async function () {
- $.get("/cache_name.txt", (data, status) => {
- var cache_name = data.split("///")[1].split("|||")[0];
- var data_to_send = {
- action: "checkversion",
- valid_cache_name: cache_name
- }
- try {
- navigator.serviceWorker.controller.postMessage(JSON.stringify(data_to_send));
- } catch (e) {
- console.log("update requested but sw is not available in app.js");
- }
- });
+ try {
+ $.get("/cache_name.txt", (data, status) => {
+ var cache_name = data.split("///")[1].split("|||")[0];
+ var data_to_send = {
+ action: "checkversion",
+ valid_cache_name: cache_name
+ }
+ try {
+ navigator.serviceWorker.controller.postMessage(JSON.stringify(data_to_send));
+ } catch (e) {
+ console.log("update requested but sw is not available in app.js");
+ }
+ });
+ } catch (e) {
+ console.log("update requested but failed because of network error probably in update_app_function in app.js");
+ }
}
var error_report_function = async function (msg, url, lineNo, columnNo, error) {
@@ -101,12 +105,12 @@ window.onunhandledrejection = error_report_function;
document.addEventListener("DOMContentLoaded", () => {
- var update_interval = setInterval( () => { // ok, it's value is never read, so what?!
+ var update_interval = setInterval(() => { // ok, it's value is never read, so what?!
localforage.getItem("lastUpdate").then((data) => {
- if(Math.floor(Date.now() / 1000) > data + BEZIAPP_UPDATE_INTERVAL) {
+ if (Math.floor(Date.now() / 1000) > data + BEZIAPP_UPDATE_INTERVAL) {
// trigger an update
update_app_function();
}
});
- }, 1000*BEZIAPP_UPDATE_INTERVAL);
+ }, 1000 * BEZIAPP_UPDATE_INTERVAL);
}); \ No newline at end of file