Concatenates all of the specified observable sequences, as long as the previous observable sequence terminated successfully.
args
(Array
|arguments
): Observable sequences or Promises to concatenate.
(Observable
): An observable sequence that contains the elements of each given sequence, in sequential order.
/* 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
File:
Dist:
Prerequisites:
- None
NPM Packages:
NuGet Packages:
Unit Tests: