We are used to using Observables in a certain way. We construct them from something and we start listening to values that they emit. There is usually very little we can do to affect what is being emitted after the point of creation. Sure, we can change it and filter it, but it is next to impossible to add more to our Observable unless we merge it with another stream. Let's have a look at when we are really in control of what is being emitted when it comes to Observables, using the create() operator:
let stream$ = Rx.Observable.create(observer => {
observer.next(1);
observer.next(2);
});
stream$.subscribe(data => console.log(data));
We see the Observable acting as a wrapper around the thing that really emits our values, the Observer. In our Observer instance, the Observer is calling next(), with a parameter to emit values – values that we listen to in...