import { merge as mergeStatic } from '../observable/merge'; export { merge as mergeStatic } from '../observable/merge'; /* tslint:enable:max-line-length */ /** * Creates an output Observable which concurrently emits all values from every * given input Observable. * * Flattens multiple Observables together by blending * their values into one Observable. * * * * `merge` subscribes to each given input Observable (either the source or an * Observable given as argument), and simply forwards (without doing any * transformation) all the values from all the input Observables to the output * Observable. The output Observable only completes once all input Observables * have completed. Any error delivered by an input Observable will be immediately * emitted on the output Observable. * * @example Merge together two Observables: 1s interval and clicks * var clicks = Rx.Observable.fromEvent(document, 'click'); * var timer = Rx.Observable.interval(1000); * var clicksOrTimer = clicks.merge(timer); * clicksOrTimer.subscribe(x => console.log(x)); * * @example Merge together 3 Observables, but only 2 run concurrently * var timer1 = Rx.Observable.interval(1000).take(10); * var timer2 = Rx.Observable.interval(2000).take(6); * var timer3 = Rx.Observable.interval(500).take(10); * var concurrent = 2; // the argument * var merged = timer1.merge(timer2, timer3, concurrent); * merged.subscribe(x => console.log(x)); * * @see {@link mergeAll} * @see {@link mergeMap} * @see {@link mergeMapTo} * @see {@link mergeScan} * * @param {ObservableInput} other An input Observable to merge with the source * Observable. More than one input Observables may be given as argument. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input * Observables being subscribed to concurrently. * @param {Scheduler} [scheduler=null] The IScheduler to use for managing * concurrency of input Observables. * @return {Observable} An Observable that emits items that are the result of * every input Observable. * @method merge * @owner Observable */ export function merge(...observables) { return (source) => source.lift.call(mergeStatic(source, ...observables)); } //# sourceMappingURL=merge.js.map