Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Latest commit

 

History

History
83 lines (65 loc) · 2.58 KB

concat.md

File metadata and controls

83 lines (65 loc) · 2.58 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: