1
votes

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?

1
Try something like this Notifier.switch(() => Stream.take(1))Yury Tarabanko

1 Answers

1
votes

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.