Fynn
Fynn

Reputation: 4893

How to assert min. time between observable emits

I have an RxJS observable that emits values after random times between 0 and 1000ms.

How do I assert that there is a gap of at least 200ms between each emit of the observable? No values should be dropped / skipped and values should still be emitted in the order they come in.

Upvotes: 0

Views: 58

Answers (1)

gil
gil

Reputation: 2552

you could achieve that by combining your source observable with interval operator, using the zip operator.

zip documentation from rxjs:

Combines multiple Observables to create an Observable whose values are calculated from the values, in order, of each of its input Observables.

Upvotes: 1

Related Questions