March 2018
Intermediate to advanced
364 pages
8h 21m
English
The merge() operator takes data from different streams and combines it. Here is the thing though: these streams can be of any kind as long as they are of type Observable. This means we can combine data from a timing operation, a promise, static data from an of() operator, and so on. What merging does is to interleave the emitted data. This means that it will emit from both streams at the same time in the following example. Using the operator comes in two flavors, as a static method but also as an instance method:
// combination/merge.jslet promiseStream = Rx.Observable.from(new Promise(resolve => resolve("data")))let stream = Rx.Observable.interval(500).take(3);let stream2 = Rx.Observable.interval(500).take(5);// instance ...
Read now
Unlock full access