UNPKG

function-performer

Version:

Performer providing API for debounce, throttle and deduplication functions

22 lines (21 loc) 770 B
type DebouncedFunction = (...args: any[]) => any; type ThrottledFunction = (...args: any[]) => any; type DeduplicatedFunction = (count: number, ...args: any[]) => any; type TimedFunctionConfig = { interval?: number; }; type PerformerConfig = { debounce?: TimedFunctionConfig; throttle?: TimedFunctionConfig; deduplication?: TimedFunctionConfig; }; export declare class Performer { private readonly _debounce; private readonly _throttle; private readonly _deduplication; constructor(config?: PerformerConfig); debounce(func: DebouncedFunction, ...args: unknown[]): void; throttle(func: ThrottledFunction, ...args: unknown[]): void; deduplicate(func: DeduplicatedFunction, ...args: unknown[]): void; } export default Performer;