btw how do you make viewmodel´s observable not dis...
# rx
u
btw how do you make viewmodel´s observable not disposed between config changes without relays, only via replayed hot observable?
refCount
would dispose it after first UI onDestroy, since its the only subscriber
a
refCount
is a method on
ConnectableObservable
right? I think if you used it without the
refCount
you would then need to dispose it manually
u
so
viewmodel.onDestroy { obs.disconnect() }
?
isnt this kind of dangerous to have this teardown available on a observable that is exposed publicly? relays cant be broken like this
a
You don’t need to expose it
You can just expose it as
Observable
and if you’re afraid somebody would cast it back, you can use
.hide()
if you are exposing a relay, I’d say it’s as bad
you’d let anybody post new items to it then
u
yea, true
@arekolek Im noobing out today .. how would you shut down hot observable? .publish.connect ... if you dispose this it will do nothing to upstream, is there some cancel or something?
other than takeUntil { destroySignal }