from()

The from() operator allows us to create an Observable from some other asynchronous/synchronous concept. It's really powerful when almost anything can be made into an Observable, as this allows for rich composition. Here is what a typical snippet can look like:

let stream$ = Rx.Observable.from(new Promise(resolve, reject) => {
resolve('some data');
});

stream$.subscribe( data => console.log(data)); // some data

let stream2$ = Rx.Observable.from([1,2,3,4]);
stream2$.subscribe( data => console.log(data)); // 1,2,3,4
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.97.75