Throttle Function/Action
Creates a throttled version of a callback that ensures it executes at most once every specified interval.
throttleAction
Creates a throttled version of a callback that ensures it executes at most once every specified interval. Ideal for controlling calls on rapid, repeat events like scrolling or resizing.
Function Signature
function throttleAction<T extends VoidFn>(
callback: T,
delay?: number
): DelayedFn<T>Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
callback | VoidFn | The function to throttle. | — |
delay | number (optional) | Delay interval in milliseconds. | 150 |
Returns
DelayedFn<T>: A throttled version of the callback function.
Example Usage
playground.ts
Behavior Details
- Interval Execution: Once triggered, the function will execute immediately (leading edge), and ignore subsequent invocations until the specified
delayinterval has elapsed. - Performance Protection: Helps prevent high-frequency event listeners (like scroll, mousemove, or resize) from blocking the browser's rendering thread.
Related Functions
- debounceAction — Delays execution until inactivity.
Last updated: Sun, Jun 14, 2026 07:06:16AM (UTC)
