Rx.Observable.prototype.concat(...args)
Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
Arguments
args
(arguments | Array): An array or arguments of Observable sequences.
Returns
(Observable
): An observable sequence that contains the elements of each given sequence, in sequential order.
Example
var source = Rx.Observable
.return(42)
.concat(Rx.Observable.return(56), Rx.Observable.return(72));
var subscription = source.subscribe(
function (x) {
console.log('Next: ' + x.toString());
},
function (err) {
console.log('Error: ' + err);
},
function () {
console.log('Completed');
});
// => Next: 42
// => Next: 56
// => Next: 72
// => Completed
// With a promise
var source = Rx.Observable.just(42)
.concat(Promise.resolve(42));
var subscription = source.subscribe(
function (x) {
console.log('Next: ' + x.toString());
},
function (err) {
console.log('Error: ' + err);
},
function () {
console.log('Completed');
});
// => Next: 42
// => Next: 42
// => Completed
Location
File:
Dist:
Prerequisites:
NPM Packages:
NuGet Packages:
Unit Tests: