Update typing for circuit-breaker-js

This commit is contained in:
Timur Amirov 2018-03-28 13:14:26 +02:00
parent b27c13d93a
commit 7addf7ae18
2 changed files with 15 additions and 1 deletions

View File

@ -10,3 +10,11 @@ status = CircuitBreaker.OPEN;
breaker.forceOpen();
breaker.forceClose();
breaker.run((success, failure) => {
if (Math.random() > 0.5) {
success();
} else {
failure();
}
});

View File

@ -30,7 +30,13 @@ declare class CircuitBreaker {
static CLOSED: 2;
constructor(options?: CircuitBreaker.Options);
run(command: () => void, fallback?: () => void): void;
run(
command: (
success: () => void,
failure: () => void,
) => void,
fallback?: () => void
): void;
forceClose(): void;
forceOpen(): void;
unforce(): void;