mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
backo2: expose properties, improve docs (#38451)
This commit is contained in:
parent
acb3cb292b
commit
028523c9cb
@ -10,4 +10,9 @@ const backoff3 = new Backoff({
|
||||
});
|
||||
|
||||
const y: number = backoff3.duration();
|
||||
const attempts: number = backoff3.attempts;
|
||||
const min: number = backoff3.ms;
|
||||
const max: number = backoff3.max;
|
||||
const jitter: number = backoff3.jitter;
|
||||
const factor: number = backoff3.factor;
|
||||
backoff3.reset();
|
||||
|
||||
29
types/backo2/index.d.ts
vendored
29
types/backo2/index.d.ts
vendored
@ -14,17 +14,40 @@ type BackoffOptions = Partial<{
|
||||
declare class Backoff {
|
||||
constructor(opts?: BackoffOptions);
|
||||
|
||||
/**
|
||||
* The number of previous attempts
|
||||
*/
|
||||
attempts: number;
|
||||
/**
|
||||
* A lower bound on the duration between attempts
|
||||
*/
|
||||
ms: number;
|
||||
/**
|
||||
* An upper bound on the duration between attempts
|
||||
*/
|
||||
max: number;
|
||||
/**
|
||||
* An upper bound on the variance around the duration between attempts
|
||||
*/
|
||||
jitter: number;
|
||||
/**
|
||||
* The base to which the attempt is raised as an exponent
|
||||
*/
|
||||
factor: number;
|
||||
/**
|
||||
* Compute the backoff duration and increment the number of attempts
|
||||
*/
|
||||
duration(): number;
|
||||
/**
|
||||
* Reset the number of attempts.
|
||||
* Reset the number of attempts
|
||||
*/
|
||||
reset(): void;
|
||||
/**
|
||||
* Set the minimum duration
|
||||
* Set the minimum duration between attempts
|
||||
*/
|
||||
setMin(min: number): void;
|
||||
/**
|
||||
* Set the maximum duration
|
||||
* Set the maximum duration between attempts
|
||||
*/
|
||||
setMax(max: number): void;
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user