rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
23 lines • 956 B
TypeScript
/**
* @public
*/
export type TDebouncedFn<TArgs extends unknown[]> = ((...args: TArgs) => void) & {
cancel: () => void;
};
/**
* @public
* Creates a function that will proxy calls to `functionToProxy` when `wait` time has passed since the last call, using the
* most recent arguments. Where `immediate` is true, the function immediately proxies the call and will not proxy again until
* `wait` time passes since the last call.
*
* @param functionToProxy - The function to debounce.
* @param wait - Time to wait in ms.
* @param immediate - If true run on the leading edge, default false.
* @returns A debounced function.
*
* @remarks
* As per underscore's debounce, except that returns have been disallowed.
* See {@link fpDebounce}.
*/
export declare function fpDebounce<TArgs extends unknown[]>(wait: number, immediate: boolean, functionToProxy: (...args: TArgs) => void): TDebouncedFn<TArgs>;
//# sourceMappingURL=fp-debounce.d.ts.map