Skip to content

Latest commit

 

History

History
69 lines (55 loc) · 2.41 KB

merge.md

File metadata and controls

69 lines (55 loc) · 2.41 KB

Rx.Observable.merge([scheduler], ...args)

Merges all the observable sequences and Promises into a single observable sequence.

Arguments

  1. [scheduler] (Scheduler=Rx.Scheduler.immediate): Scheduler to run the timer on. If not specified, Rx.Scheduler.immediate is used.
  2. args (Array|arguments): Observable sequences to merge into a single sequence.

Returns

(Observable): An observable sequence that produces a value after each period.

Example

var source1 = Rx.Observable.interval(100)
    .timeInterval()
    .pluck('interval');
var source2 = Rx.Observable.interval(150)
    .timeInterval()
    .pluck('interval');

var source = Rx.Observable.merge(
    source1,
    source2)
    .take(5);

var subscription = source.subscribe(
    function (x) {
        console.log('Next: ' + x);
    },
    function (err) {
        console.log('Error: ' + err);
    },
    function () {
        console.log('Completed');
    });

// => Next: 100
// => Next: 150
// => Next: 100
// => Next: 150
// => Next: 100
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: