Debounce
Creates a debounced function that delays invoking the provided function until after the specified delay.
| Category | Functions |
| Author | Pol Gubau |
| Since | 1.0.0 |
| Last Updated | 2025-03-15 |
| Type | Sync |
| Compatibility | Universal |
Example
Input
const debouncedFunc = debounce(() => console.log('Hello'), 1000);Output:
Logs 'Hello' after a 1-second delay.
Return
Returns a new debounced function.
Type: function
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| fn | function | null | Yes | The function to debounce. |
| delay | number | null | Yes | The number of milliseconds to delay. |
Notes
The returned function will delay the invocation of `fn` until after the specified `delay` period.
Tags
- debounce
- delay
- function