• Version 2.0.0
  • Published
  • 6.42 kB
  • No dependencies
  • MIT license


npm i debounce
yarn add debounce
pnpm add debounce


Delay function calls until a set time elapses after the last invocation



Type Aliases


function debounce

debounce: <F extends AnyFunction>(
function_: F,
wait?: number,
options?: { immediate: boolean }
) => debounce.DebouncedFunction<F>;
  • Creates a debounced function that delays execution until wait milliseconds have passed since its last invocation.

    Set the immediate option to true to invoke the function immediately at the start of the wait interval, preventing issues such as double-clicks on a button.

    The returned function has a .clear() method to cancel scheduled executions, and a .flush() method for immediate execution and resetting the timer for future calls.

Type Aliases

type DebouncedFunction

type DebouncedFunction<F extends AnyFunction> = {
(...arguments_: Parameters<F>): ReturnType<F> | undefined;
clear(): void;
flush(): void;

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (2)

    Peer Dependencies (0)

    No peer dependencies.


    To add a badge like this badgeto your package's README, use the codes available below.

    You may also use to create a custom badge linking to

    • Markdown
    • HTML
      <a href=""><img src="" alt=""></a>