UNPKG

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.

92 lines (43 loc) 1.48 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [fpDebounce](./rc-js-util.fpdebounce.md) ## fpDebounce() function 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. **Signature:** ```typescript export declare function fpDebounce<TArgs extends unknown[]>(wait: number, immediate: boolean, functionToProxy: (...args: TArgs) => void): TDebouncedFn<TArgs>; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> wait </td><td> number </td><td> Time to wait in ms. </td></tr> <tr><td> immediate </td><td> boolean </td><td> If true run on the leading edge, default false. </td></tr> <tr><td> functionToProxy </td><td> (...args: TArgs) =&gt; void </td><td> The function to debounce. </td></tr> </tbody></table> **Returns:** [TDebouncedFn](./rc-js-util.tdebouncedfn.md)<!-- -->&lt;TArgs&gt; A debounced function. ## Remarks As per underscore's debounce, except that returns have been disallowed. See [fpDebounce()](./rc-js-util.fpdebounce.md)<!-- -->.