These are chat archives for ReactiveX/RxJava

26th
Feb 2016
David Stemmer
@weefbellington
Feb 26 2016 01:14
is there a version of merge that outputs an Observable that completes if any of the source observables complete? It looks like merge will only complete if all of the source observables complete
Bob van der Linden
@bobvanderlinden
Feb 26 2016 15:27
Is there a way to easily convert an Observable to a BehaviorSubject?
Dorus
@Dorus
Feb 26 2016 15:27
.replay(1)?
Bob van der Linden
@bobvanderlinden
Feb 26 2016 15:28
hmm, let me look into that
@Dorus That does indeed sounds like what I'm looking for. Thanks!
Dorus
@Dorus
Feb 26 2016 15:30
^_^
Bob van der Linden
@bobvanderlinden
Feb 26 2016 16:07
do you think it would be helpful to have a shorthand for replay(1).refCount(), just like share() is for .publish().refCount(), or would that clutter the API too much?
Dorus
@Dorus
Feb 26 2016 16:08
replay(1).refCount() sounds totally useless. What's your usecase?
Bob van der Linden
@bobvanderlinden
Feb 26 2016 16:09
i have an observable that represents the state of my view. it needs to be able to refresh and there are multiple views that are watching that observable. so if the state changes, the views need to be updated
so, that's why I was thinking of something like BehaviorSubject
Dorus
@Dorus
Feb 26 2016 16:10
ah ic, makes sense then
So the first subscription activates the view and the rest listens in
Bob van der Linden
@bobvanderlinden
Feb 26 2016 16:11
but a separate BehaviorSubject is too much of an hassle when you have a Observable already
multiple views subscribe to the 'state'. When the first subscription is made, a state-retrieval-process starts running. I don't want multiple subscriptions to trigger multiple state-retrieval-processes, i just want one to run when multiple views are interested in the same state.
to be less abstract: it's about the USB state of Android
Dorus
@Dorus
Feb 26 2016 16:14
yeah, replay(1).refCount() totally solves that. Anyway i cant argue about the API surface thing as that's not to me to decided, i did already see some my feature requests shot down because of it :P
Bob van der Linden
@bobvanderlinden
Feb 26 2016 16:15
yes, sounds reasonable
maybe i'll do an PR and see whether the maintainers find it acceptable. otherwise I'll just force myself to use kotlin+extension methods some more