function injectDebouncedCallback<TFn>(fn, options): (...args) => void;
Defined in: debouncer/injectDebouncedCallback.ts:40
An Angular function that creates a debounced version of a callback function. This function is essentially a wrapper around injectDebouncer that provides a simplified API for basic debouncing needs.
The debounced function will only execute after the specified wait time has elapsed since its last invocation. If called again before the wait time expires, the timer resets and starts waiting again.
This function provides a simpler API compared to injectDebouncer, making it ideal for basic debouncing needs. However, it does not expose the underlying Debouncer instance.
For advanced usage requiring features like:
Consider using the injectDebouncer function instead.
TFn extends AnyFunction
TFn
DebouncerOptions<TFn>
(...args): void;
...Parameters<TFn>
void
// Debounce a search handler
const handleSearch = injectDebouncedCallback((query: string) => {
fetchSearchResults(query);
}, {
wait: 500 // Wait 500ms between executions
});
// Use in an input
<input
type="search"
(input)="handleSearch($event.target.value)"
/>