Toolbox-XToolbox-X

Debounce Function/Action

Creates a debounced version of a callback that delays its execution until after a specified period of inactivity.

debounceAction

Creates a debounced version of a callback that delays its execution until after a specified period of inactivity. Useful for search, auto-complete, resize, and other rapid trigger scenarios.

Function Signature

function debounceAction<T extends VoidFn>(
  callback: T,
  delay?: number
): DelayedFn<T>

Parameters

ParameterTypeDescriptionDefault
callbackVoidFnThe function to debounce.
delaynumber (optional)Delay in milliseconds.300

Returns

  • DelayedFn<T>: A debounced version of the callback function.

Example Usage


Behavior Details

  • Delay resetting: Each invocation of the debounced function clears the previous timer and sets a new one. The callback is only executed when the delay period passes without any new calls.
  • Arguments Preservation: Arguments passed to the debounced function are forwarded directly to the callback during execution.

Last updated: Sun, Jun 14, 2026 07:06:16AM (UTC)

On this page