Overview
Emits a value from the source Observable, then ignores subsequent source values forduration milliseconds, then repeats this process.
throttleTime emits the source Observable values on the output Observable when its internal timer is disabled, and ignores source values when the timer is enabled.Type Signature
Parameters
Time to wait before emitting another value after emitting the last value, measured in milliseconds or time unit determined by the optional
scheduler.The SchedulerLike to use for managing the timers that handle the throttling.
Configuration object to define
leading and trailing behavior. Defaults to { leading: true, trailing: false }.Returns
MonoTypeOperatorFunction<T> - A function that returns an Observable that performs the throttle operation to limit the rate of emissions from the source.
Usage Examples
Basic Example: Limit Click Rate
With Leading and Trailing
Scroll Handler
When to Use
Use throttleTime when:
- You want to limit event frequency to a fixed rate
- You need the first value in each time window
- Handling rapid UI events (clicks, scrolls, resizes)
- Implementing rate limiting for API calls
Don’t use throttleTime when:
- You want the last value (use
auditTimeinstead) - You need dynamic duration (use
throttleinstead) - You want to wait for silence (use
debounceTimeinstead)
Comparison with Similar Operators
| Operator | Emits | Duration |
|---|---|---|
throttleTime | First value in window | Fixed time |
auditTime | Last value in window | Fixed time |
throttle | First value in window | Dynamic (from Observable) |
debounceTime | Last value after silence | Fixed time |
Related Operators
- throttle - Same behavior but with dynamic duration
- auditTime - Emits last value instead of first
- debounceTime - Waits for silence before emitting
- sampleTime - Samples at fixed intervals
- audit - Like throttle but emits last value
