debounceTime

accepts 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

accepts 1 input stream, time period number

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

returns a new stream of throttled values

Published on Monday, 11 Dec. 2017
Revised on Monday, 8 Oct. 2018

debounceTime vs throttleTime in RxJS

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


The Illustrated Book of RxJS


The JavaScript pipeline operator proposal


Launchpad for RxJS

CĂ©dric Soulas Follow Hire me

Freelance Developer Advocate. Motion graphics with code. JavaScript and Elm. cedricsoulas.com

Subscribe to reactive.how newsletter

Join the Newsletter

Learn Reactive Programming and stay up-to-date:

Receive my latest news, product updates and programming visualizations. You can unsubscribe at any time.

Highlights

@CedricSoulas

Making an illustrated book!

The Illustrated Book of RxJS

Learn more →