...

/

Creating Observables and Operators

Creating Observables and Operators

Learn about the creation process of Observables, Observers, and their fundamental methods.

We'll cover the following...

There are several ways to create Observables, the create operator being the most obvious one. The create operator in the Rx.Observable object takes a callback that accepts an Observer as a parameter. This function defines how the Observable will emit values. Here’s how we create a simple Observable:

Press + to interact
var observable = Rx.Observable.create(function(observer)
{
observer.onNext('Simon');
observer.onNext('Jen');
observer.onNext('Sergi');
observer.onCompleted(); // We are done
});

When we subscribe to this Observable, it emits three ...

Access this course and 1400+ top-rated courses and projects.