Skip to content

Latest commit

 

History

History
70 lines (45 loc) · 1.73 KB

File metadata and controls

70 lines (45 loc) · 1.73 KB

{% if book.isPdf==true %}

concat

{% endif %}

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

{% if book.isPdf %}

/* 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(
  x => console.log(`onNext: ${x}`),
  e => console.log(`onError: ${e}`),
  () => console.log('onCompleted'));

// => onNext: 42
// => onNext: 56
// => onCompleted
/* 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(
  x => console.log(`onNext: ${x}`),
  e => console.log(`onError: ${e}`),
  () => console.log('onCompleted'));

// => onNext: 42
// => onNext: 56
// => onCompleted

{% else %}

Using Observable sequences

Using Promises and Observable sequences

{% endif %}