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
observable
using 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
ConnectableConfig
and specify theconnector
property with a function that returns a reference theSubject
.