diff options
author | sijanec <sijanecantonluka@gmail.com> | 2020-06-08 22:56:22 +0200 |
---|---|---|
committer | sijanec <sijanecantonluka@gmail.com> | 2020-06-08 22:56:22 +0200 |
commit | f1e3feaf44adb79aec054fce431b0a235a929466 (patch) | |
tree | c011d1d08c1f73891a0c3912fa1427b296d8b8d0 | |
parent | added update mechanism, DO NOT MERGE b4 seeing commit notes! (diff) | |
download | beziapp-f1e3feaf44adb79aec054fce431b0a235a929466.tar beziapp-f1e3feaf44adb79aec054fce431b0a235a929466.tar.gz beziapp-f1e3feaf44adb79aec054fce431b0a235a929466.tar.bz2 beziapp-f1e3feaf44adb79aec054fce431b0a235a929466.tar.lz beziapp-f1e3feaf44adb79aec054fce431b0a235a929466.tar.xz beziapp-f1e3feaf44adb79aec054fce431b0a235a929466.tar.zst beziapp-f1e3feaf44adb79aec054fce431b0a235a929466.zip |
-rw-r--r-- | assets/js/app.js.bvr | 21 | ||||
-rw-r--r-- | dist/cache_name.txt | 2 | ||||
-rwxr-xr-x | dist/js/app.js | 23 | ||||
-rwxr-xr-x | dist/pages/about.html | 2 | ||||
-rwxr-xr-x | dist/sw.js | 4 |
5 files changed, 33 insertions, 19 deletions
diff --git a/assets/js/app.js.bvr b/assets/js/app.js.bvr index 0a91078..5b74aba 100644 --- a/assets/js/app.js.bvr +++ b/assets/js/app.js.bvr @@ -2,6 +2,7 @@ const app_version = "<@?g app_version@>"; const previous_commit = "<@?g latest_commit@>"; const BEZIAPP_UPDATE_INTERVAL = 300; // update vsakih 300 sekund + if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") .then(() => { }) @@ -59,7 +60,11 @@ var update_app_function = async function () { action: "checkversion", valid_cache_name: cache_name } - navigator.serviceWorker.controller.postMessage(JSON.stringify(data_to_send)); + try { + navigator.serviceWorker.controller.postMessage(JSON.stringify(data_to_send)); + } catch (e) { + console.log("update requested but sw is not available in app.js"); + } }); } @@ -96,10 +101,12 @@ window.onunhandledrejection = error_report_function; document.addEventListener("DOMContentLoaded", () => { - localforage.getItem("lastUpdate").then((data) => { - if(Math.floor(Date.now() / 1000) > data + BEZIAPP_UPDATE_INTERVAL) { - // trigger an update - update_app_function(); - } - }); + 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) { + // trigger an update + update_app_function(); + } + }); + }, 1000*BEZIAPP_UPDATE_INTERVAL); });
\ No newline at end of file diff --git a/dist/cache_name.txt b/dist/cache_name.txt index 30e3bd1..7fd0531 100644 --- a/dist/cache_name.txt +++ b/dist/cache_name.txt @@ -2,4 +2,4 @@ -///site-static-1.0.14.3-beta-134d890||| +///site-static-1.0.14.3-beta-571c27a||| diff --git a/dist/js/app.js b/dist/js/app.js index 87de1fc..3ebf360 100755 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -3,8 +3,9 @@ const app_version = "1.0.14.3-beta"; -const previous_commit = "134d89078f864250abf340713edc1d23d90ede24"; +const previous_commit = "571c27a64e8452a58a05d85bf40e1d7885d2dd1b"; const BEZIAPP_UPDATE_INTERVAL = 300; // update vsakih 300 sekund + if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js") .then(() => { }) @@ -62,7 +63,11 @@ var update_app_function = async function () { action: "checkversion", valid_cache_name: cache_name } - navigator.serviceWorker.controller.postMessage(JSON.stringify(data_to_send)); + try { + navigator.serviceWorker.controller.postMessage(JSON.stringify(data_to_send)); + } catch (e) { + console.log("update requested but sw is not available in app.js"); + } }); } @@ -99,10 +104,12 @@ window.onunhandledrejection = error_report_function; document.addEventListener("DOMContentLoaded", () => { - localforage.getItem("lastUpdate").then((data) => { - if(Math.floor(Date.now() / 1000) > data + BEZIAPP_UPDATE_INTERVAL) { - // trigger an update - update_app_function(); - } - }); + 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) { + // trigger an update + update_app_function(); + } + }); + }, 1000*BEZIAPP_UPDATE_INTERVAL); }) diff --git a/dist/pages/about.html b/dist/pages/about.html index 179db07..35a4b94 100755 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -161,7 +161,7 @@ <div class="row"> <p> <small> - ^HEAD 134d89078f864250abf340713edc1d23d90ede24 + ^HEAD 571c27a64e8452a58a05d85bf40e1d7885d2dd1b </small> </p> </div> @@ -3,8 +3,8 @@ // Change version to cause cache refresh -const static_cache_name = "site-static-1.0.14.3-beta-134d890"; -// commit before the latest is 134d89078f864250abf340713edc1d23d90ede24 +const static_cache_name = "site-static-1.0.14.3-beta-571c27a"; +// commit before the latest is 571c27a64e8452a58a05d85bf40e1d7885d2dd1b // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! |