Disable update timer
This commit is contained in:
parent
fca70f482f
commit
4afbefbc9f
@ -32,10 +32,11 @@ var SERVER = (location.protocol + '//' + location.hostname +
|
|||||||
var ROOT_PATH = location.pathname.replace(new RegExp("/+[^/]+/*(/index\.html?)?$"), "") + '/';
|
var ROOT_PATH = location.pathname.replace(new RegExp("/+[^/]+/*(/index\.html?)?$"), "") + '/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* time between updates of collections.
|
* time between updates of collections (milliseconds)
|
||||||
* @const
|
* @const
|
||||||
|
* @type {?int}
|
||||||
*/
|
*/
|
||||||
var UPDATE_INTERVAL = 10000;
|
var UPDATE_INTERVAL = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regex to match and normalize color
|
* Regex to match and normalize color
|
||||||
@ -580,6 +581,7 @@ function CollectionsScene(user, password, collection, onerror) {
|
|||||||
var saved_template_display = null;
|
var saved_template_display = null;
|
||||||
/** @type {?XMLHttpRequest} */ var collections_req = null;
|
/** @type {?XMLHttpRequest} */ var collections_req = null;
|
||||||
var timer = null;
|
var timer = null;
|
||||||
|
var from_update = false;
|
||||||
/** @type {?Array<Collection>} */ var collections = null;
|
/** @type {?Array<Collection>} */ var collections = null;
|
||||||
/** @type {Array<Node>} */ var nodes = [];
|
/** @type {Array<Node>} */ var nodes = [];
|
||||||
|
|
||||||
@ -675,7 +677,10 @@ function CollectionsScene(user, password, collection, onerror) {
|
|||||||
} else {
|
} else {
|
||||||
var old_collections = collections;
|
var old_collections = collections;
|
||||||
collections = collections1;
|
collections = collections1;
|
||||||
|
if (UPDATE_INTERVAL !== null) {
|
||||||
timer = window.setTimeout(update, UPDATE_INTERVAL);
|
timer = window.setTimeout(update, UPDATE_INTERVAL);
|
||||||
|
}
|
||||||
|
from_update = true;
|
||||||
if (old_collections === null) {
|
if (old_collections === null) {
|
||||||
pop_scene(scene_index);
|
pop_scene(scene_index);
|
||||||
} else {
|
} else {
|
||||||
@ -700,7 +705,7 @@ function CollectionsScene(user, password, collection, onerror) {
|
|||||||
} else if (collections === null) {
|
} else if (collections === null) {
|
||||||
pop_scene(scene_index - 1);
|
pop_scene(scene_index - 1);
|
||||||
} else {
|
} else {
|
||||||
if (timer !== null) {
|
if (from_update) {
|
||||||
show_collections(collections);
|
show_collections(collections);
|
||||||
} else {
|
} else {
|
||||||
collections = null;
|
collections = null;
|
||||||
@ -716,6 +721,7 @@ function CollectionsScene(user, password, collection, onerror) {
|
|||||||
window.clearTimeout(timer);
|
window.clearTimeout(timer);
|
||||||
timer = null;
|
timer = null;
|
||||||
}
|
}
|
||||||
|
from_update = false;
|
||||||
if (collections !== null && collections_req !== null) {
|
if (collections !== null && collections_req !== null) {
|
||||||
collections_req.abort();
|
collections_req.abort();
|
||||||
collections_req = null;
|
collections_req = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user