www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 1a97f27fe3acb0ab3b85dc5584f76c05e8ac53cf
parent 05de47149f917aec448f43175e2443bc875ad8a9
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 27 Apr 2016 02:34:46 -0400

Use Bluebird reflect() instead of deprecated settle()

Diffstat:
Mresource/concurrentCaller.js | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/resource/concurrentCaller.js b/resource/concurrentCaller.js @@ -105,16 +105,17 @@ ConcurrentCaller.prototype.pause = function (ms) { * Add a task to the queue without starting it * * @param {Function|Function[]} - One or more functions to run - * @return {Promise[]} - An array of promises for passed functions, resolved once they have all - * finished (even if other functions are still running) + * @return {Promise|Promise<PromiseInspection[]>} - If one function is passed, a promise for the return + * value of the passed function; if multiple, a promise for an array of PromiseInspection objects + * for those functions, resolved once they have all finished, even if other functions are still running */ ConcurrentCaller.prototype.add = function (func) { if (Array.isArray(func)) { let promises = []; for (let i = 0; i < func.length; i++) { - promises.push(this.start(func[i])); + promises.push(this.start(func[i]).reflect()); } - return Promise.settle(promises); + return Promise.all(promises); } if (!this._deferred || !this._deferred.promise.isPending()) {