debounceTime

1 input stream time period number

  • Whenever an event is emitted, the time period of silence measured restarts from zero
  • It waits for a time period of silence and then emits the latest value of the input stream

returns a new stream of debounced values

throttleTime

1 input stream time period number

  • It starts by emitting the first event of the input stream
  • Then, it limits the rate of events to at most one per time period

returns a new stream of throttled values

If your stream is created from key presses or mouse movements, you’ll likely deal with bursts of events. But you can’t react to every single event, as it would overload the CPU or flood the servers with too many requests.

❚ debounceTime rate-limits events, based on an “emission silence” window of time. ❚ throttleTime doesn’t delay events.

They both accept a time period argument, such as 500 milliseconds.

See also


debounceTime vs delay


scan vs reduce


zip vs combineLatest


The JavaScript pipeline operator proposal

💌 Learn Reactive Programming and stay tuned

Occasional updates, plus:

News

@CedricSoulas