[Search] Timeout length & indexed check
Changed timeout to 0 ms. Changed check for already indexed to an empty return.
This commit is contained in:
@@ -39,7 +39,7 @@ define(
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param $q Angular's $q, for promise consolidation.
|
* @param $q Angular's $q, for promise consolidation.
|
||||||
* @param $timeout Angular's $timeout, for delayed funtion execution.
|
* @param $timeout Angular's $timeout, for delayed function execution.
|
||||||
* @param {ObjectService} objectService The service from which
|
* @param {ObjectService} objectService The service from which
|
||||||
* domain objects can be gotten.
|
* domain objects can be gotten.
|
||||||
* @param {WorkerService} workerService The service which allows
|
* @param {WorkerService} workerService The service which allows
|
||||||
@@ -127,30 +127,32 @@ define(
|
|||||||
nodes.forEach(function (node) {
|
nodes.forEach(function (node) {
|
||||||
var id = node && node.getId && node.getId();
|
var id = node && node.getId && node.getId();
|
||||||
|
|
||||||
// If we have not yet indexed this item, index it
|
// If we have already indexed this item, stop here
|
||||||
if (!indexed[id]) {
|
if (indexed[id]) {
|
||||||
// Index each item with the web worker
|
return;
|
||||||
indexItem(node);
|
}
|
||||||
indexed[id] = true;
|
|
||||||
|
// Index each item with the web worker
|
||||||
if (node && node.hasCapability && node.hasCapability('composition')) {
|
indexItem(node);
|
||||||
// This node has children
|
indexed[id] = true;
|
||||||
|
|
||||||
// Make sure that this is async, so doesn't block up page
|
|
||||||
$timeout(function () {
|
// If this node has children, index those
|
||||||
// Get the children...
|
if (node && node.hasCapability && node.hasCapability('composition')) {
|
||||||
node.useCapability('composition').then(function (children) {
|
// Make sure that this is async, so doesn't block up page
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
// ... then index the children
|
// Get the children...
|
||||||
if (children.constructor === Array) {
|
node.useCapability('composition').then(function (children) {
|
||||||
indexItems(children);
|
$timeout(function () {
|
||||||
} else {
|
// ... then index the children
|
||||||
indexItems([children]);
|
if (children.constructor === Array) {
|
||||||
}
|
indexItems(children);
|
||||||
}, 100);
|
} else {
|
||||||
});
|
indexItems([children]);
|
||||||
}, 100);
|
}
|
||||||
}
|
}, 0);
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watch for changes to this item, in case it gets new children
|
// Watch for changes to this item, in case it gets new children
|
||||||
|
|||||||
Reference in New Issue
Block a user