- Learn to use multicasted Observables.
- Learn to use the connectable() function.
- Learn to use connect() and share() operators.
As of version 7.0 of RxJS, the following have been deprecated:
The goal of the deprecations is to reduce the surface of the API.
multicast() operator was used to create a
Similar to the
connectable() function above, the resulting
ConnectableObservable had to be connected to the provided
Subject through the use of a
publish() operator was a shorthand operator to the
multicast() operator where providing the connecting
Subject instance was not necessary.
Next up, the
refCount() operator is also no longer necessary with these deprecations.
refCount() operator previously enabled automatic internal reference counting of the number of Observers.
Internally, when the number of Observers was incremented from 0 to 1, the operator would internally invoke the
connect() method on the
Likewise, when the number of Observers was decremented from 1 to 0, the operator would internally invoke the
unsubscribe() method on the
Subscribtion within the closure.
Finally, it should be noted that with these deprecations the
share() operator has been refactored.
share() operator was a shorthand operator for using the
multicast() with the
We'll learn more about the
If your RxJS dependency is < 7.0, you can learn about the