1 line
6.4 KiB
JSON
1 line
6.4 KiB
JSON
|
{"ast":null,"code":"import { isArray } from '../util/isArray';\nimport { fromArray } from './fromArray';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function race(...observables) {\n if (observables.length === 1) {\n if (isArray(observables[0])) {\n observables = observables[0];\n } else {\n return observables[0];\n }\n }\n return fromArray(observables, undefined).lift(new RaceOperator());\n}\nexport class RaceOperator {\n call(subscriber, source) {\n return source.subscribe(new RaceSubscriber(subscriber));\n }\n}\nexport class RaceSubscriber extends OuterSubscriber {\n constructor(destination) {\n super(destination);\n this.hasFirst = false;\n this.observables = [];\n this.subscriptions = [];\n }\n _next(observable) {\n this.observables.push(observable);\n }\n _complete() {\n const observables = this.observables;\n const len = observables.length;\n if (len === 0) {\n this.destination.complete();\n } else {\n for (let i = 0; i < len && !this.hasFirst; i++) {\n const observable = observables[i];\n const subscription = subscribeToResult(this, observable, undefined, i);\n if (this.subscriptions) {\n this.subscriptions.push(subscription);\n }\n this.add(subscription);\n }\n this.observables = null;\n }\n }\n notifyNext(_outerValue, innerValue, outerIndex) {\n if (!this.hasFirst) {\n this.hasFirst = true;\n for (let i = 0; i < this.subscriptions.length; i++) {\n if (i !== outerIndex) {\n let subscription = this.subscriptions[i];\n subscription.unsubscribe();\n this.remove(subscription);\n }\n }\n this.subscriptions = null;\n }\n this.destination.next(innerValue);\n }\n}","map":{"version":3,"names":["isArray","fromArray","OuterSubscriber","subscribeToResult","race","observables","length","undefined","lift","RaceOperator","call","subscriber","source","subscribe","RaceSubscriber","constructor","destination","hasFirst","subscriptions","_next","observable","push","_complete","len","complete","i","subscription","add","notifyNext","_outerValue","innerValue","outerIndex","unsubscribe","remove","next"],"sources":["/home/arctichawk1/Desktop/Projects/Public/Kargi-Sitesi/node_modules/rxjs/_esm2015/internal/observable/race.js"],"sourcesContent":["import { isArray } from '../util/isArray';\nimport { fromArray } from './fromArray';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function race(...observables) {\n if (observables.length === 1) {\n if (isArray(observables[0])) {\n observables = observables[0];\n }\n else {\n return observables[0];\n }\n }\n return fromArray(observables, undefined).lift(new RaceOperator());\n}\nexport class RaceOperator {\n call(subscriber, source) {\n return source.subscribe(new RaceSubscriber(subscriber));\n }\n}\nexport class RaceSubscriber extends OuterSubscriber {\n constructor(destination) {\n super(destination);\n this.hasFirst = false;\n this.observables = [];\n this.subscriptions = [];\n }\n _next(observable) {\n this.observables.push(observable);\n }\n _complete() {\n const observables = this.observables;\n const len = observables.length;\n if (len === 0) {\n this.destination.complete();\n }\n else {\n for (let i = 0; i < len && !this.hasFirst; i++) {\n const observable = observables[i];\n const subscription = subscribeToResult(this, observable, undefined, i);\n if (this.subscriptions) {\n this.subscriptions.push(subscription);\n }\n this.add(subscription);\n }\n this.observables = null;\n }\n }\n notifyNext(_outerValue, innerValue, outerIndex)
|