PATH:
usr
/
local
/
lib
/
node_modules
/
ghost-cli
/
node_modules
/
rxjs
/
_esm2015
/
internal
/
observable
import { isArray } from '../util/isArray'; import { fromArray } from './fromArray'; import { OuterSubscriber } from '../OuterSubscriber'; import { subscribeToResult } from '../util/subscribeToResult'; export function race(...observables) { if (observables.length === 1) { if (isArray(observables[0])) { observables = observables[0]; } else { return observables[0]; } } return fromArray(observables, undefined).lift(new RaceOperator()); } export class RaceOperator { call(subscriber, source) { return source.subscribe(new RaceSubscriber(subscriber)); } } export class RaceSubscriber extends OuterSubscriber { constructor(destination) { super(destination); this.hasFirst = false; this.observables = []; this.subscriptions = []; } _next(observable) { this.observables.push(observable); } _complete() { const observables = this.observables; const len = observables.length; if (len === 0) { this.destination.complete(); } else { for (let i = 0; i < len && !this.hasFirst; i++) { let observable = observables[i]; let subscription = subscribeToResult(this, observable, observable, i); if (this.subscriptions) { this.subscriptions.push(subscription); } this.add(subscription); } this.observables = null; } } notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) { if (!this.hasFirst) { this.hasFirst = true; for (let i = 0; i < this.subscriptions.length; i++) { if (i !== outerIndex) { let subscription = this.subscriptions[i]; subscription.unsubscribe(); this.remove(subscription); } } this.subscriptions = null; } this.destination.next(innerValue); } } //# sourceMappingURL=race.js.map
[-] zip.js.map
[edit]
[-] concat.js
[edit]
[-] fromEventPattern.js
[edit]
[-] combineLatest.js
[edit]
[-] using.js
[edit]
[-] fromArray.js.map
[edit]
[-] generate.js
[edit]
[-] generate.js.map
[edit]
[+]
dom
[+]
..
[-] defer.js
[edit]
[-] ConnectableObservable.js
[edit]
[-] concat.js.map
[edit]
[-] from.js.map
[edit]
[-] range.js.map
[edit]
[-] merge.js.map
[edit]
[-] bindCallback.js
[edit]
[-] forkJoin.js.map
[edit]
[-] bindNodeCallback.js.map
[edit]
[-] SubscribeOnObservable.js
[edit]
[-] interval.js
[edit]
[-] fromPromise.js.map
[edit]
[-] of.js
[edit]
[-] ConnectableObservable.js.map
[edit]
[-] throwError.js.map
[edit]
[-] iif.js
[edit]
[-] timer.js.map
[edit]
[-] merge.js
[edit]
[-] bindCallback.js.map
[edit]
[-] onErrorResumeNext.js
[edit]
[-] onErrorResumeNext.js.map
[edit]
[-] partition.js
[edit]
[-] never.js.map
[edit]
[-] fromPromise.js
[edit]
[-] pairs.js
[edit]
[-] timer.js
[edit]
[-] interval.js.map
[edit]
[-] zip.js
[edit]
[-] iif.js.map
[edit]
[-] fromArray.js
[edit]
[-] race.js
[edit]
[-] range.js
[edit]
[-] race.js.map
[edit]
[-] forkJoin.js
[edit]
[-] bindNodeCallback.js
[edit]
[-] throwError.js
[edit]
[-] fromEvent.js
[edit]
[-] empty.js.map
[edit]
[-] defer.js.map
[edit]
[-] SubscribeOnObservable.js.map
[edit]
[-] empty.js
[edit]
[-] pairs.js.map
[edit]
[-] fromIterable.js.map
[edit]
[-] never.js
[edit]
[-] fromEventPattern.js.map
[edit]
[-] combineLatest.js.map
[edit]
[-] partition.js.map
[edit]
[-] using.js.map
[edit]
[-] fromEvent.js.map
[edit]
[-] of.js.map
[edit]
[-] from.js
[edit]
[-] fromIterable.js
[edit]