Throttling
The buffer() and window() operators batch up emissions into collections or observables based on a defined scope, which regularly consolidates rather than omits emissions. The throttle() operator, however, omits emissions when they occur rapidly. This is helpful when rapid emissions are assumed to be redundant or unwanted, such as a user clicking a button repeatedly. For these situations, you can use the throttleLast(), throttleFirst(), and throttleWithTimeout() operators to only let the first or last element in a rapid sequence of emissions through. How you choose one of the many rapid emissions is determined by your choice of the operator and its parameters.
For the examples in this section, we are going to work with the following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access