Reputation: 217
In RxJS we have the sample
operator that, according to the docs:
Emits the most recently emitted value from the source Observable whenever another Observable, the notifier, emits.
I want something similar, but with the values emmited after the notifier emits.
With sample:
Stream: -a---b-c---d--
Notifier: ---x-----x----
Result: -a-----c------
With what I want:
Stream: -a---b-c---d--
Notifier: ---x-----x----
Result: -----b-----d--
Is there an operator or combination of operators that does this?
Upvotes: 1
Views: 82
Reputation: 18665
There is a complete answer to that question here : Emitting only after set of events?
As Yuri mentioned in his comment, if your Stream
is hot, you can use Stream.take(1)
, if it is cold, have a look at the answer linked thereabove. It uses the window
operator.
Upvotes: 1