mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 15:02:23 +00:00
[Build] Replace setTimeout with
To avoid need to declare global usage to satisfy JSHint
This commit is contained in:
parent
6aeb156a58
commit
9526207af8
@ -103,6 +103,7 @@ define([
|
|||||||
"type": "provider",
|
"type": "provider",
|
||||||
"implementation": GenericSearchProvider,
|
"implementation": GenericSearchProvider,
|
||||||
"depends": [
|
"depends": [
|
||||||
|
"$timeout",
|
||||||
"$q",
|
"$q",
|
||||||
"$log",
|
"$log",
|
||||||
"modelService",
|
"modelService",
|
||||||
|
@ -41,8 +41,9 @@ define([
|
|||||||
* @param {TopicService} topic the topic service.
|
* @param {TopicService} topic the topic service.
|
||||||
* @param {Array} ROOTS An array of object Ids to begin indexing.
|
* @param {Array} ROOTS An array of object Ids to begin indexing.
|
||||||
*/
|
*/
|
||||||
function GenericSearchProvider($q, $log, modelService, workerService, topic, ROOTS) {
|
function GenericSearchProvider($timeout, $q, $log, modelService, workerService, topic, ROOTS) {
|
||||||
var provider = this;
|
var provider = this;
|
||||||
|
this.$timeout = $timeout;
|
||||||
this.$q = $q;
|
this.$q = $q;
|
||||||
this.$log = $log;
|
this.$log = $log;
|
||||||
this.modelService = modelService;
|
this.modelService = modelService;
|
||||||
@ -188,7 +189,8 @@ define([
|
|||||||
*/
|
*/
|
||||||
GenericSearchProvider.prototype.beginIndexRequest = function () {
|
GenericSearchProvider.prototype.beginIndexRequest = function () {
|
||||||
var idToIndex = this.idsToIndex.shift(),
|
var idToIndex = this.idsToIndex.shift(),
|
||||||
provider = this;
|
provider = this,
|
||||||
|
$timeout = this.$timeout;
|
||||||
|
|
||||||
this.pendingRequests += 1;
|
this.pendingRequests += 1;
|
||||||
this.modelService
|
this.modelService
|
||||||
@ -204,10 +206,10 @@ define([
|
|||||||
.warn('Failed to index domain object ' + idToIndex);
|
.warn('Failed to index domain object ' + idToIndex);
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
setTimeout(function () {
|
$timeout(function () {
|
||||||
provider.pendingRequests -= 1;
|
provider.pendingRequests -= 1;
|
||||||
provider.keepIndexing();
|
provider.keepIndexing();
|
||||||
}, 0);
|
}, 0, false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
runs*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SearchSpec. Created by shale on 07/31/2015.
|
* SearchSpec. Created by shale on 07/31/2015.
|
||||||
@ -43,6 +42,7 @@ define([
|
|||||||
provider;
|
provider;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
$timeout = jasmine.createSpy('$timeout');
|
||||||
$q = jasmine.createSpyObj(
|
$q = jasmine.createSpyObj(
|
||||||
'$q',
|
'$q',
|
||||||
['defer']
|
['defer']
|
||||||
@ -82,6 +82,7 @@ define([
|
|||||||
spyOn(GenericSearchProvider.prototype, 'scheduleForIndexing');
|
spyOn(GenericSearchProvider.prototype, 'scheduleForIndexing');
|
||||||
|
|
||||||
provider = new GenericSearchProvider(
|
provider = new GenericSearchProvider(
|
||||||
|
$timeout,
|
||||||
$q,
|
$q,
|
||||||
$log,
|
$log,
|
||||||
modelService,
|
modelService,
|
||||||
|
Loading…
Reference in New Issue
Block a user