Skip to content

Latest commit

 

History

History
82 lines (64 loc) · 2.49 KB

concat.md

File metadata and controls

82 lines (64 loc) · 2.49 KB

Rx.Observable.concat(...args)

Concatenates all of the specified observable sequences, as long as the previous observable sequence terminated successfully.

Arguments

  1. args (Array | arguments): Observable sequences or Promises to concatenate.

Returns

(Observable): An observable sequence that contains the elements of each given sequence, in sequential order.

Example

/* Using Observable sequences */
var source1 = Rx.Observable.return(42);
var source2 = Rx.Observable.return(56);

var source = Rx.Observable.concat(source1, source2);

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

// => Next: 42
// => Next: 56
// => Completed

/* Using Promises and Observable sequences */
var source1 = Rx.Observable.return(42);
var source2 = RSVP.Promise.resolve(56);

var source = Rx.Observable.concat(source1, source2);

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

// => Next: 42
// => Next: 56
// => Completed

Location

File:

Dist:

Prerequisites:

  • None

NPM Packages:

NuGet Packages:

Unit Tests: