This is an automated email from the ASF dual-hosted git repository. raphinesse pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cordova-android.git
commit 8fb49ec7ec6aeec6a94e4d0ae530d90ef63a7196 Author: Gearoid M <[email protected]> AuthorDate: Mon Jun 18 15:15:24 2018 +0900 Fix typo in variable name in retry.js --- bin/templates/cordova/lib/retry.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bin/templates/cordova/lib/retry.js b/bin/templates/cordova/lib/retry.js index 3ea8f14..b2b9a44 100644 --- a/bin/templates/cordova/lib/retry.js +++ b/bin/templates/cordova/lib/retry.js @@ -27,21 +27,20 @@ var events = require('cordova-common').events; * Retry a promise-returning function a number of times, propagating its * results on success or throwing its error on a failed final attempt. * - * @arg {Number} attemts_left - The number of times to retry the passed call. + * @arg {Number} attemptsLeft - The number of times to retry the passed call. * @arg {Function} promiseFunction - A function that returns a promise. * @arg {...} - Arguments to pass to promiseFunction. * * @returns {Promise} */ -module.exports.retryPromise = function (attemts_left, promiseFunction) { +module.exports.retryPromise = function (attemptsLeft, promiseFunction) { // NOTE: - // get all trailing arguments, by skipping the first two (attemts_left and + // get all trailing arguments, by skipping the first two (attemptsLeft and // promiseFunction) because they shouldn't get passed to promiseFunction var promiseFunctionArguments = Array.prototype.slice.call(arguments, 2); return promiseFunction.apply(undefined, promiseFunctionArguments).then( - // on success pass results through function onFulfilled (value) { return value; @@ -49,17 +48,16 @@ module.exports.retryPromise = function (attemts_left, promiseFunction) { // on rejection either retry, or throw the error function onRejected (error) { + attemptsLeft -= 1; - attemts_left -= 1; - - if (attemts_left < 1) { + if (attemptsLeft < 1) { throw error; } - events.emit('verbose', 'A retried call failed. Retrying ' + attemts_left + ' more time(s).'); + events.emit('verbose', 'A retried call failed. Retrying ' + attemptsLeft + ' more time(s).'); - // retry call self again with the same arguments, except attemts_left is now lower - var fullArguments = [attemts_left, promiseFunction].concat(promiseFunctionArguments); + // retry call self again with the same arguments, except attemptsLeft is now lower + var fullArguments = [attemptsLeft, promiseFunction].concat(promiseFunctionArguments); return module.exports.retryPromise.apply(undefined, fullArguments); } ); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
