MCPcopy Index your code
hub / github.com/MathieuTurcotte/node-backoff / FunctionCall

Function FunctionCall

lib/function_call.js:12–31  ·  view source on GitHub ↗
(fn, args, callback)

Source from the content-addressed store, hash-verified

10
11// Wraps a function to be called in a backoff loop.
12function FunctionCall(fn, args, callback) {
13 events.EventEmitter.call(this);
14
15 precond.checkIsFunction(fn, 'Expected fn to be a function.');
16 precond.checkIsArray(args, 'Expected args to be an array.');
17 precond.checkIsFunction(callback, 'Expected callback to be a function.');
18
19 this.function_ = fn;
20 this.arguments_ = args;
21 this.callback_ = callback;
22 this.lastResult_ = [];
23 this.numRetries_ = 0;
24
25 this.backoff_ = null;
26 this.strategy_ = null;
27 this.failAfter_ = -1;
28 this.retryPredicate_ = FunctionCall.DEFAULT_RETRY_PREDICATE_;
29
30 this.state_ = FunctionCall.State_.PENDING;
31}
32util.inherits(FunctionCall, events.EventEmitter);
33
34// States in which the call can be.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected