Is it a common pattern to use Subjects to cache an...
# rx
a
Is it a common pattern to use Subjects to cache an observables emission? Like using a BehaviourSubject to cache the last item emitted? To me it somewhat feels like a misuse if I only have one subscriber. Is it just me?
t
anstaendig: I would try to use replay(1) followed by an autoConnect()
a
And what if source is a single
.toObservable.replaty(1) ?
l
It’s not something I would consider super bad as I just use it as a middle man http://blog.bradcampbell.nz/keep-your-main-thread-synchronous/ but you have to handle the termination yourself. Mine never terminates