Sha256: 7e8299edde661d5f6b1374d94aecfd1b0c159338ab93e7e2d9ae03ba47238e24

Contents?: true

Size: 1.55 KB

Versions: 49

Compression:

Stored size: 1.55 KB

Contents

import { Observable } from '../Observable';
import { isArray } from '../util/isArray';
import { MonoTypeOperatorFunction, OperatorFunction } from '../interfaces';
import { race as raceStatic } from '../observable/race';

/* tslint:disable:max-line-length */
export function race<T>(observables: Array<Observable<T>>): MonoTypeOperatorFunction<T>;
export function race<T, R>(observables: Array<Observable<T>>): OperatorFunction<T, R>;
export function race<T>(...observables: Array<Observable<T> | Array<Observable<T>>>): MonoTypeOperatorFunction<T>;
export function race<T, R>(...observables: Array<Observable<any> | Array<Observable<any>>>): OperatorFunction<T, R>;
/* tslint:enable:max-line-length */

/**
 * Returns an Observable that mirrors the first source Observable to emit an item
 * from the combination of this Observable and supplied Observables.
 * @param {...Observables} ...observables Sources used to race for which Observable emits first.
 * @return {Observable} An Observable that mirrors the output of the first Observable to emit an item.
 * @method race
 * @owner Observable
 */
export function race<T>(...observables: Array<Observable<T> | Array<Observable<T>>>): MonoTypeOperatorFunction<T> {
  return function raceOperatorFunction(source: Observable<T>) {
    // if the only argument is an array, it was most likely called with
    // `pair([obs1, obs2, ...])`
    if (observables.length === 1 && isArray(observables[0])) {
      observables = <Array<Observable<T>>>observables[0];
    }

    return source.lift.call(raceStatic<T>(source, ...observables));
  };
}

Version data entries

49 entries across 49 versions & 4 rubygems

Version Path
govuk_publishing_components-17.8.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.7.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.6.1 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.6.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.5.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.4.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.3.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.2.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.1.1 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.1.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-17.0.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-16.29.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-16.28.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-16.27.1 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-16.27.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-16.26.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-16.25.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-16.24.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-16.23.0 node_modules/rxjs/src/operators/race.ts
govuk_publishing_components-16.22.0 node_modules/rxjs/src/operators/race.ts