I would like to observe my BehaviourSubject
. In RxJava 1 I was calling asObservable(), which is now gone.
I found publish()
but it returns connectable, which I don't want to.
How to turn behavior subject into observable in RxJava 2?
Observables provide support for passing messages between parts of your application. They are used frequently in Angular and are a technique for event handling, asynchronous programming, and handling multiple values.
Angular makes use of observables as an interface to handle a variety of common asynchronous operations. For example: The HTTP module uses observables to handle AJAX requests and responses. The Router and Forms modules use observables to listen for and respond to user-input events.
An observable is a function that creates an observer and attaches it to the source where values are expected from, for example, clicks, mouse events from a dom element or an Http request, etc.
capable of being or liable to be observed; noticeable; visible; discernible: an observable change in attitude. worthy or important enough to be celebrated, followed, or observed: an observable holiday. deserving of attention; noteworthy.
You're probably looking for Observable.hide()
Hides the identity of this Observable and its Disposable. Allows hiding extra features such as Subject's Observer methods or preventing certain identity-based optimizations (fusion).
From the What's different in 2.0 page, from 1.x Observable to 2.x Flowable :
asObservable : renamed to hide(), hides all identities now
So it seems that the hide method is what you are looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With