import { ClassMethodDecorator } from "./decorators/types"; export interface AsyncLimiterState { readonly key: string; working: boolean; nextCallParams: any; nextCallTimer: any; last_call: number; initial_call: number; last_exec: number; } export interface LimiterFunction { (state: AsyncLimiterState): number; } interface GenericLimiterOptions

{ key_on?: number[] | ((params: P) => string); /** If using NodeJS, whether `unref()` should be called on any timers. Basically, if set to `true`, NodeJS will be allowed to exit without calling the function */ unref?: boolean; limiter_logic: (options: any) => LimiterFunction; } type LimitableFunction = (...params: any[]) => void; export declare const async_limiter: (options: GenericLimiterOptions, func: T) => { (...args: Parameters): void; cancel_pending(...args: Parameters): void; }; export declare function limiter_decorator_combo LimiterFunction>(limiter: T): {

(options: Parameters[0] & Omit, "limiter_logic">): ClassMethodDecorator any>; void>(options: Parameters[0] & Omit, "limiter_logic">, func: T_1): { (...args: Parameters): void; cancel_pending(...args: Parameters): void; }; limiting_logic: T; }; /** First call goes through, next call waits until `interval` after the first call */ export declare const throttle: {

(options: { interval: number; } & Omit, "limiter_logic">): ClassMethodDecorator any>; void>(options: { interval: number; } & Omit, "limiter_logic">, func: T): { (...args: Parameters): void; cancel_pending(...args: Parameters): void; }; limiting_logic: ({ interval }: { interval: number; }) => LimiterFunction; }; /** All calls are delayed until no call has been received for `timeToStability` (or until `maxTime` after the first call) */ export declare const debounce: {

(options: { timeToStability: number; maxTime?: number; } & Omit, "limiter_logic">): ClassMethodDecorator any>; void>(options: { timeToStability: number; maxTime?: number; } & Omit, "limiter_logic">, func: T): { (...args: Parameters): void; cancel_pending(...args: Parameters): void; }; limiting_logic: ({ timeToStability, maxTime }: { timeToStability: number; maxTime?: number; }) => LimiterFunction; }; /** Debounce _then_ throttle - `debounce(throttle(X))` */ export declare const limit: {

(options: { interval: number; timeToStability: number; maxTime?: number; } & Omit, "limiter_logic">): ClassMethodDecorator any>; void>(options: { interval: number; timeToStability: number; maxTime?: number; } & Omit, "limiter_logic">, func: T): { (...args: Parameters): void; cancel_pending(...args: Parameters): void; }; limiting_logic: ({ interval, timeToStability, maxTime }: { interval: number; timeToStability: number; maxTime?: number; }) => LimiterFunction; }; export {};