Comparing version 0.3.0 to 0.4.0
@@ -14,3 +14,3 @@ var dns = require('dns'); | ||
operation.try(function(currentAttempt) { | ||
operation.attempt(function(currentAttempt) { | ||
dns.resolve(address, function(err, addresses) { | ||
@@ -17,0 +17,0 @@ if (operation.retry(err)) { |
@@ -27,3 +27,3 @@ function RetryOperation(timeouts) { | ||
RetryOperation.prototype.try = function(fn) { | ||
RetryOperation.prototype.attempt = function(fn) { | ||
this._fn = fn; | ||
@@ -33,2 +33,12 @@ this._fn(this._attempts); | ||
RetryOperation.prototype.try = function(fn) { | ||
console.log('Using RetryOperation.try() is deprecated'); | ||
this.attempt(fn); | ||
}; | ||
RetryOperation.prototype.start = function(fn) { | ||
console.log('Using RetryOperation.start() is deprecated'); | ||
this.attempt(fn); | ||
}; | ||
RetryOperation.prototype.start = RetryOperation.prototype.try; | ||
@@ -35,0 +45,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "Abstraction for exponential and custom retry strategies for failed operations.", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/felixge/node-retry", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -26,3 +26,3 @@ # retry | ||
operation.try(function(currentAttempt) { | ||
operation.attempt(function(currentAttempt) { | ||
dns.resolve(address, function(err, addresses) { | ||
@@ -113,3 +113,3 @@ if (operation.retry(err)) { | ||
#### retryOperation.try(fn) | ||
#### retryOperation.attempt(fn) | ||
@@ -119,5 +119,9 @@ Defines the function `fn` that is to be retried and executes it for the first | ||
#### retryOperation.try(fn) | ||
This is an alias for `retryOperation.attempt(fn)`. This is deprecated. | ||
#### retryOperation.start(fn) | ||
This is an alias for `retryOperation.try(fn)`. | ||
This is an alias for `retryOperation.attempt(fn)`. This is deprecated. | ||
@@ -139,1 +143,10 @@ #### retryOperation.retry(error) | ||
retry is licensed under the MIT license. | ||
#Changelog | ||
0.4.0 Changed retryOperation.try() to retryOperation.attempt(). Deprecated the aliases start() and try() for it. | ||
0.3.0 Added retryOperation.start() which is an alias for retryOperation.try(). | ||
0.2.0 Added attempts() function and parameter to retryOperation.try() representing the number of attempts it took to call fn(). |
@@ -43,3 +43,3 @@ var common = require('../common'); | ||
var fn = new Function(); | ||
operation.try(fn); | ||
operation.attempt(fn); | ||
assert.strictEqual(fn, operation._fn); | ||
@@ -58,3 +58,3 @@ })(); | ||
var fn = function() { | ||
operation.try(function(currentAttempt) { | ||
operation.attempt(function(currentAttempt) { | ||
attempts++; | ||
@@ -61,0 +61,0 @@ assert.equal(currentAttempt, attempts); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13306
238
148