biobulkbende.org/node_modules/rxjs/_esm5/operator/merge.js

59 lines
2.4 KiB
JavaScript
Raw Normal View History

2020-09-16 12:23:28 +00:00
/** PURE_IMPORTS_START .._operators_merge PURE_IMPORTS_END */
import { merge as higherOrder } from '../operators/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.
*
* <span class="informal">Flattens multiple Observables together by blending
* their values into one Observable.</span>
*
* <img src="./img/merge.png" width="100%">
*
* `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 <caption>Merge together two Observables: 1s interval and clicks</caption>
* 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 <caption>Merge together 3 Observables, but only 2 run concurrently</caption>
* 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() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
return higherOrder.apply(void 0, observables)(this);
}
//# sourceMappingURL=merge.js.map