15 lines
302 B
JavaScript
15 lines
302 B
JavaScript
|
/**
|
||
|
* Create deferred object.
|
||
|
* @returns {{promise, resolve, reject}}
|
||
|
*/
|
||
|
export function createDeferred () {
|
||
|
let deferred = {};
|
||
|
|
||
|
deferred.promise = new Promise(function (resolve, reject) {
|
||
|
deferred.resolve = resolve;
|
||
|
deferred.reject = reject;
|
||
|
});
|
||
|
|
||
|
return deferred;
|
||
|
}
|