1

How can I construct an Observable stream that will emit a value, then skip subsequent values for x amount of time?

I have tried using throttle and a combination of skipUntil and delay, but I need all values emitted in the given interval to be ignored, not delayed.

Use case is that I have a button that can be clicked at most every X seconds.

altschuler
  • 3,694
  • 2
  • 28
  • 55

1 Answers1

0

I believe you can in fact use throttleTime for this, it will discard the throttled results:

const source$ = fromEvent(this.myButton, 'click');

source$.pipe(
  throttleTime(1000),
)

See the docs:

https://www.learnrxjs.io/operators/filtering/throttletime.html

Will Taylor
  • 1,650
  • 9
  • 23