3

I want to use the RX Throttle method to 'debounce' events, such that the subscription doesn't fire if more messages are seen within a given time period.

This works well, but I also want to prevent Throttle from debouncing indefinitely, such that the subscription will always fire if some timeout passes regardless of whether more messages have been seen.

For example, as long as new messages are seen at least once every 1 second, don't fire the subscription - unless 10 seconds has passed since we started debouncing, in which case do fire.

I've been playing around with combinations of Throttle with other RX methods, but I can't figure out how to do this.

Cocowalla
  • 13,822
  • 6
  • 66
  • 112
  • Personally my face implementation is http://stackoverflow.com/questions/20034476/how-can-i-use-reactive-extensions-to-throttle-events-using-a-max-window-size – Michal Ciechan Mar 27 '17 at 21:15
  • The linked duplicate is pretty old and some of the RX APIs have changed since then. However, I added an answer myself that can provide a base for a custom operator that compiles with the current version of RX. The solution suggested by @MichalCiechan also works with the current version of RX. – Martin Liversage Mar 27 '17 at 21:30

0 Answers0