From 4afbefbc9f72046d27bde3d678a76242c7a1953a Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 4 Jun 2017 15:43:20 +0200 Subject: [PATCH] Disable update timer --- radicale/web/fn.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/radicale/web/fn.js b/radicale/web/fn.js index cc313e3..3e72efb 100644 --- a/radicale/web/fn.js +++ b/radicale/web/fn.js @@ -32,10 +32,11 @@ var SERVER = (location.protocol + '//' + location.hostname + var ROOT_PATH = location.pathname.replace(new RegExp("/+[^/]+/*(/index\.html?)?$"), "") + '/'; /** - * time between updates of collections. + * time between updates of collections (milliseconds) * @const + * @type {?int} */ -var UPDATE_INTERVAL = 10000; +var UPDATE_INTERVAL = null; /** * Regex to match and normalize color @@ -580,6 +581,7 @@ function CollectionsScene(user, password, collection, onerror) { var saved_template_display = null; /** @type {?XMLHttpRequest} */ var collections_req = null; var timer = null; + var from_update = false; /** @type {?Array} */ var collections = null; /** @type {Array} */ var nodes = []; @@ -675,7 +677,10 @@ function CollectionsScene(user, password, collection, onerror) { } else { var old_collections = collections; collections = collections1; - timer = window.setTimeout(update, UPDATE_INTERVAL); + if (UPDATE_INTERVAL !== null) { + timer = window.setTimeout(update, UPDATE_INTERVAL); + } + from_update = true; if (old_collections === null) { pop_scene(scene_index); } else { @@ -700,7 +705,7 @@ function CollectionsScene(user, password, collection, onerror) { } else if (collections === null) { pop_scene(scene_index - 1); } else { - if (timer !== null) { + if (from_update) { show_collections(collections); } else { collections = null; @@ -716,6 +721,7 @@ function CollectionsScene(user, password, collection, onerror) { window.clearTimeout(timer); timer = null; } + from_update = false; if (collections !== null && collections_req !== null) { collections_req.abort(); collections_req = null;