Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is RxJS 6 static merge?

Tags:

rxjs

rxjs6

In RxJS 6, how do I import a static merge function for merging a list of Observables?

I want to be able to do:

const merged$ = merge(     obs1$,     obs2$,     obs3$ ); 

I've tried:

import { merge } from 'rxjs/observable/merge'; and

import { merge } from 'rxjs/operators';

but neither seems to give me what I want.

like image 275
bingles Avatar asked Apr 27 '18 12:04

bingles


People also ask

How do I combine multiple Observables into one?

We can use the concat operator to take multiple Observables and return a new Observable that sequentially emits values from each Observable that were passed in. It works by subscribing to them one at a time and merging the results in the output Observable.

What is mergeAll?

mergeAll combines a number of inner observable streams and concurrently emits all values from every input stream. It's similar to merge, but instead of taking a set of streams directly as input, it takes an observable source that produces other streams (observables).


1 Answers

Importing has been made easy in RxJS 6:

 import { merge } from 'rxjs'; 

You may want to read the official migration guide.

Another useful resource regarding importing in RxJS 6 is this talk by Ben Lesh who is the RxJS lead.

like image 106
siva636 Avatar answered Oct 09 '22 11:10

siva636