Unrud пре 8 година
родитељ
комит
4afbefbc9f
1 измењених фајлова са 10 додато и 4 уклоњено
  1. 10 4
      radicale/web/fn.js

+ 10 - 4
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<Collection>} */ var collections = null;
     /** @type {Array<Node>} */ 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;