declare function abortOn(this: { abort: (cause: string) => void; then?: Promise['then']; }, signal?: AbortSignal): { abort: (cause: string) => void; then?: ((onfulfilled?: ((value: any) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise) | undefined; }; type Handler = { shouldBeRequeued?: boolean; fn: () => (...args: any[]) => Promise | void; priority: number; abort: (cause?: unknown) => void; done: () => void; }; type QueueOptions = { priority?: number; }; export interface AbortablePromise extends Promise { abort(cause?: unknown): void; abortOn: (...args: Parameters) => AbortablePromise; } export type WrapPromiseFunctionType any> = (...args: Parameters) => AbortablePromise>>; export declare class RateLimitedQueue { #private; limit: number; constructor(limit?: number); run(fn: Handler['fn'], queueOptions?: QueueOptions): Handler | Omit; wrapSyncFunction(fn: () => void, queueOptions: QueueOptions): () => { abortOn: typeof abortOn; abort: Handler['abort']; }; wrapPromiseFunction any>(fn: T, queueOptions?: QueueOptions): (...args: Parameters) => AbortablePromise>>; resume(): void; /** * Freezes the queue for a while or indefinitely. * * @param {number | null } [duration] Duration for the pause to happen, in milliseconds. * If omitted, the queue won't resume automatically. */ pause(duration?: number | null): void; /** * Pauses the queue for a duration, and lower the limit of concurrent requests * when the queue resumes. When the queue resumes, it tries to progressively * increase the limit in `this.#increaseLimit` until another call is made to * `this.rateLimit`. * Call this function when using the RateLimitedQueue for network requests and * the remote server responds with 429 HTTP code. * * @param {number} duration in milliseconds. */ rateLimit(duration: number): void; get isPaused(): boolean; } export declare const internalRateLimitedQueue: unique symbol; export {}; //# sourceMappingURL=RateLimitedQueue.d.ts.map