debounceTime
debounceTime
operator delays the emission of signal until a specified amount of time has passed since the last emit. This can be useful for scenarios where you want to react to changes in a signal but only after a certain quiet period has elapsed.debounceTime<T>(dueTime: number, options: SignalDebounceTimeOptions<T> = {}): T
Parameters
dueTime | The amount of time (in milliseconds) to wait after a signal is emitted before allowing it to be further processed. If another signal is emitted during this delay period, the timer resets |
options | Optional. The combination of CreateEffectOptions and CreateSignalOptions (excluding the allowSignalWrites and manualCleanup properties) |
Example
Debounced search query
@Component()
export class MyComponent {
searchQuery: Signal<string> = signal('');
debouncedSearchQuery: Signal<string> = signalPipe(source, debounceTime(500));
}