First commit
This commit is contained in:
31
node_modules/backoff/index.js
generated
vendored
Normal file
31
node_modules/backoff/index.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2012 Mathieu Turcotte
|
||||
// Licensed under the MIT license.
|
||||
|
||||
var Backoff = require('./lib/backoff');
|
||||
var ExponentialBackoffStrategy = require('./lib/strategy/exponential');
|
||||
var FibonacciBackoffStrategy = require('./lib/strategy/fibonacci');
|
||||
var FunctionCall = require('./lib/function_call.js');
|
||||
|
||||
module.exports.Backoff = Backoff;
|
||||
module.exports.FunctionCall = FunctionCall;
|
||||
module.exports.FibonacciStrategy = FibonacciBackoffStrategy;
|
||||
module.exports.ExponentialStrategy = ExponentialBackoffStrategy;
|
||||
|
||||
// Constructs a Fibonacci backoff.
|
||||
module.exports.fibonacci = function(options) {
|
||||
return new Backoff(new FibonacciBackoffStrategy(options));
|
||||
};
|
||||
|
||||
// Constructs an exponential backoff.
|
||||
module.exports.exponential = function(options) {
|
||||
return new Backoff(new ExponentialBackoffStrategy(options));
|
||||
};
|
||||
|
||||
// Constructs a FunctionCall for the given function and arguments.
|
||||
module.exports.call = function(fn, vargs, callback) {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
fn = args[0];
|
||||
vargs = args.slice(1, args.length - 1);
|
||||
callback = args[args.length - 1];
|
||||
return new FunctionCall(fn, vargs, callback);
|
||||
};
|
||||
Reference in New Issue
Block a user