Code coverage report for src/operator/concat.ts

Statements: 100% (12 / 12)      Branches: 100% (2 / 2)      Functions: 100% (1 / 1)      Lines: 100% (10 / 10)      Ignored: none     

All files » src/operator/ » concat.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26    1 1 1                   46 22 22   22 22 3     22    
import {Observable} from '../Observable';
import {Scheduler} from '../Scheduler';
import {isScheduler} from '../util/isScheduler';
import {ArrayObservable} from '../observable/fromArray';
import {MergeAllOperator} from './mergeAll-support';
 
/**
 * Joins this observable with multiple other observables by subscribing to them one at a time, starting with the source,
 * and merging their results into the returned observable. Will wait for each observable to complete before moving
 * on to the next.
 * @params {...Observable} the observables to concatenate
 * @params {Scheduler} [scheduler] an optional scheduler to schedule each observable subscription on.
 * @returns {Observable} All values of each passed observable merged into a single observable, in order, in serial fashion.
 */
export function concat<R>(...observables: (Observable<any> | Scheduler)[]): Observable<R> {
  let args = <any[]>observables;
  args.unshift(this);
 
  let scheduler: Scheduler = null;
  if (isScheduler(args[args.length - 1])) {
    scheduler = args.pop();
  }
 
   return new ArrayObservable(args, scheduler).lift(new MergeAllOperator(1));
}