@types/circuit-breaker-js
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

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

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: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: none

Credits

These definitions were written by Timur Amirov.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/circuit-breaker-js

Weekly Downloads

41

Version

0.0.5

License

MIT

Unpacked Size

4.52 kB

Total Files

5

Last publish

Collaborators

  • types