UNPKG

function-performer

Version:

Performer providing API for debounce, throttle, deduplication and limiting functions

13 lines (12 loc) 545 B
import { IExecutable } from './executable'; type ThrottledFunction = (...args: any[]) => any; type ThrottledFunctionConfig = { interval?: number; }; declare class Throttle implements IExecutable { private readonly _calls; private readonly _interval; constructor(config?: ThrottledFunctionConfig); execute<TFunc extends ThrottledFunction>(config: ThrottledFunctionConfig | null, func: TFunc, ...args: Parameters<TFunc>): Promise<ReturnType<TFunc>>; } export { Throttle, type ThrottledFunction, type ThrottledFunctionConfig };