2018-08-31 20:02:04 +00:00
|
|
|
import { TaskQueue } from './TaskQueue';
|
|
|
|
|
2016-01-22 15:08:58 +00:00
|
|
|
/**
|
|
|
|
* Create deferred object.
|
2017-02-05 03:54:58 +00:00
|
|
|
*
|
2016-01-22 15:08:58 +00:00
|
|
|
* @returns {{promise, resolve, reject}}
|
|
|
|
*/
|
2017-02-05 03:54:58 +00:00
|
|
|
export function createDeferred() {
|
|
|
|
const deferred = {};
|
2016-01-22 15:08:58 +00:00
|
|
|
|
2017-02-05 03:54:58 +00:00
|
|
|
deferred.promise = new Promise((resolve, reject) => {
|
2016-01-22 15:08:58 +00:00
|
|
|
deferred.resolve = resolve;
|
|
|
|
deferred.reject = reject;
|
|
|
|
});
|
|
|
|
|
|
|
|
return deferred;
|
|
|
|
}
|
2018-08-31 20:02:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an instance of {@link TaskQueue}.
|
|
|
|
*
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function createTaskQueue() {
|
|
|
|
return new TaskQueue();
|
|
|
|
}
|