0.0.5 • Published 7 months ago
@types/circuit-breaker-js v0.0.5
Installation
npm install --save @types/circuit-breaker-js
Summary
This package contains type definitions for circuit-breaker-js (http://yammer.github.io/circuit-breaker-js/).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/circuit-breaker-js.
index.d.ts
// Type definitions for circuit-breaker-js 0.0
// Project: http://yammer.github.io/circuit-breaker-js/
// Definitions by: Timur Amirov <https://github.com/DeTeam>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = CircuitBreaker;
declare namespace CircuitBreaker {
interface Options {
windowDuration?: number | undefined;
numBuckets?: number | undefined;
timeoutDuration?: number | undefined;
errorThreshold?: number | undefined;
volumeThreshold?: number | undefined;
onCircuitOpen?: ((m: Metrics) => void) | undefined;
onCircuitClose?: ((m: Metrics) => void) | undefined;
}
interface Metrics {
totalCount: number;
errorCount: number;
errorPercentage: number;
}
}
declare class CircuitBreaker {
static OPEN: 0;
static HALF_OPEN: 1;
static CLOSED: 2;
constructor(options?: CircuitBreaker.Options);
run(
command: (
success: () => void,
failure: () => void,
) => void,
fallback?: () => void
): void;
forceClose(): void;
forceOpen(): void;
unforce(): void;
isOpen(): boolean;
}
Additional Details
- Last updated: Thu, 08 Jul 2021 09:07:18 GMT
- Dependencies: none
- Global values: none
Credits
These definitions were written by Timur Amirov.