function-performer
Version:
Performer providing API for debounce, throttle, deduplication and limiting functions
13 lines (12 loc) • 536 B
TypeScript
import { IExecutable } from './executable';
type LimitedFunction = (...args: any[]) => any;
type LimitedFunctionConfig = {
max?: number;
};
declare class Limit implements IExecutable<LimitedFunctionConfig> {
private readonly _calls;
private readonly _max;
constructor(config?: LimitedFunctionConfig);
execute<TFunc extends LimitedFunction>(config: LimitedFunctionConfig | null, func: TFunc, ...args: Parameters<TFunc>): ReturnType<TFunc> | void;
}
export { Limit, type LimitedFunction, type LimitedFunctionConfig };