Exercise - Connectable
Exercise
The goal of this exercise is to learn how to create a multicasted Observable.
- Open exercise on codesandbox.
I've already imported the necessary rxjs functions and classes for you.
I also created a new
observableusing theinterval()function that will emit a value every 1000 milliseconds. - Use the connectable function to create a new connectable Observable from the source
observable. - Subscribe to the connectable observable and log out the next notification values.
- Connect the subject to the multicasted observable.
Bonus
Provide the connecting Subject.
- Define a new
Subject(). - Provide the
ConnectableConfigand specify theconnectorproperty with a function that returns a reference theSubject.