Debounce

See also

  • Official ReactiveX documentation: Debounce
Observable.debounce(duetime, scheduler=None)

Ignores values from an observable sequence which are followed by another value before duetime.

Example:

res = source.debounce(5000) # 5 seconds
res = source.debounce(5000, scheduler)
Parameters:duetime (Number) – Duration of the throttle period for each value (specified as an integer denoting milliseconds).
Keyword Arguments:
 scheduler (Scheduler) – Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
Returns:The debounced sequence.
Return type:Observable
../../_images/debounce.png
Observable.throttle_with_selector(throttle_duration_selector)

Ignores values from an observable sequence which are followed by another value within a computed throttle duration.

Example:

res = source.throttle_with_selector(lambda x: rx.Scheduler.timer(x+x))
Keyword Arguments:
 throttle_duration_selector – Selector function to retrieve a sequence indicating the throttle duration for each given element.
Returns:the throttled sequence.
Return type:Observable
Observable.throttle_with_timeout(duetime, scheduler=None)

Ignores values from an observable sequence which are followed by another value before duetime.

Example:

res = source.debounce(5000) # 5 seconds
res = source.debounce(5000, scheduler)
Parameters:duetime (Number) – Duration of the throttle period for each value (specified as an integer denoting milliseconds).
Keyword Arguments:
 scheduler (Scheduler) – Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
Returns:The debounced sequence.
Return type:Observable
../../_images/throttleWithTimeout.png