I'm creating a class for my app that keeps an internal BehaviorSubject
. Is there a way I can expose a corresponding 'BehaviorObservable
', which pipes through the values of the subject, but only has the 'read-only' stuff of the Observable
interface? The .next()
, .error()
and .complete()
methods should only be available internally.
It's not just a matter (I believe) of using Observable.create()
to pipe the subject's values through. Users of my API should .subscribe()
to the exposed observable, and then immediately get a callback for the stored current value.
I may be able to hack something together, but I'm sure I'm just missing something that RxJS can already do.