createDebouncedSignal
| Generic types: | T |
Creates a debounced signal that emits values from the source signal only after the value has stabilized for the specified duration.
Unlike , this doesn't execute a side effect callback. Use this when you just need a debounced version of a signal.
Presentation
function createDebouncedSignal (
source: Signal<T>,
options: { ms?: number | undefined; injector: Injector },
): Signal<T | undefined>;Returns
Signal<T | undefined> -A signal that emits the debounced value
Parameters
| Name | Type | Description |
|---|---|---|
| source | Signal<T> | The source signal to debounce |
| options | { ms?: number | undefined; injector: Injector; } | Configuration options |
Example usage
const input = signal('');
const debouncedInput = createDebouncedSignal (input, { ms: 300, injector });
effect(() => {
console.log('Debounced value:', debouncedInput());
});