Skip to main content

throttleTime

throttleTime operator limits the emission of values from the source signal based on a time window. It emits the first value in the window and then ignores subsequent values until the window expires.

throttleTime<T>(throttleDuration: number, options: SignalThrottleTimeOptions<T> = {}): T

Parameters

throttleDuration The duration (in milliseconds) of the time window in which only the values will be emitted
optionsOptional. The combination of CreateEffectOptions and CreateSignalOptions (excluding the allowSignalWrites property)

Example

Throttle click emissions

@Component({
template: `
<p>click count: {{ clickCount() }}</p>
<p>throttled click count: {{ throttledClickCount() }}</p>
`,
})
export class ThrottleTimeExampleComponent {
clickCount = signal(0);
throttledClickCount: Signal<number> = signalPipe(
this.clickCount,
throttleTime(1000)
); // to every 1000 milliseconds
}