@d-fischer/rate-limiter
Version:
Rate limit your requests.
12 lines (11 loc) • 391 B
TypeScript
import type { QueueEntryLimitReachedBehavior } from './QueueEntry';
export interface RateLimiterRequestOptions {
limitReachedBehavior?: QueueEntryLimitReachedBehavior;
}
export interface RateLimiter<Req, Res> {
request: (req: Req, options?: RateLimiterRequestOptions) => Promise<Res>;
clear: () => void;
pause: () => void;
resume: () => void;
destroy?: () => void;
}