is there a safer operator I can use, which would g...
# rx
u
is there a safer operator I can use, which would give me the latest value or null, sort of like
BehaviorRelay.value
?
z
You can
amb
your upstream with
Observable.just(NO_VALUE)
(where
NO_VALUE
is some sentinel value that makes sense with your types). If you put the sentinal last in the list of arguments to
amb
, you’ll get the behavior you want.
u
wouldnt the
just
always win?
oh as a last arg, I see, thanks!
z
Yep, if all the arguments emit synchronously then the winner depends on order in the list.
u
sweet