Opal-Estate-Pro/node_modules/rxjs/operators/mergeMapTo.js.map
2019-09-13 09:44:33 +07:00

1 line
10 KiB
Plaintext

{"version":3,"file":"mergeMapTo.js","sourceRoot":"","sources":["../../src/operators/mergeMapTo.ts"],"names":[],"mappings":";;;;;;AAKA,gCAAgC,oBAAoB,CAAC,CAAA;AAErD,kCAAkC,2BAA2B,CAAC,CAAA;AAM9D,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,oBAAoC,eAA8B,EAC9B,cAAuG,EACvG,UAA6C;IAA7C,0BAA6C,GAA7C,aAAqB,MAAM,CAAC,iBAAiB;IAC/E,EAAE,CAAC,CAAC,OAAO,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC;QACvC,UAAU,GAAW,cAAc,CAAC;QACpC,cAAc,GAAG,IAAI,CAAC;IACxB,CAAC;IACD,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,eAAe,EAAO,cAAc,EAAE,UAAU,CAAC,CAAC,EAArF,CAAqF,CAAC;AAC1H,CAAC;AARe,kBAAU,aAQzB,CAAA;AAED,yEAAyE;AACzE,oFAAoF;AACpF;IACE,4BAAoB,GAAuB,EACvB,cAA4F,EAC5F,UAA6C;QAArD,0BAAqD,GAArD,aAA6B,MAAM,CAAC,iBAAiB;QAF7C,QAAG,GAAH,GAAG,CAAoB;QACvB,mBAAc,GAAd,cAAc,CAA8E;QAC5F,eAAU,GAAV,UAAU,CAAmC;IACjE,CAAC;IAED,iCAAI,GAAJ,UAAK,QAAuB,EAAE,MAAW;QACvC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9G,CAAC;IACH,yBAAC;AAAD,CAAC,AATD,IASC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,MAAM,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7B,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IACH,2BAAC;AAAD,CAAC,AAjFD,CAAmD,iCAAe,GAiFjE;AAjFY,4BAAoB,uBAiFhC,CAAA","sourcesContent":["import { Observable, ObservableInput } from '../Observable';\nimport { Operator } from '../Operator';\nimport { PartialObserver } from '../Observer';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OperatorFunction } from '../interfaces';\n\n/* tslint:disable:max-line-length */\nexport function mergeMapTo<T, R>(observable: ObservableInput<R>, concurrent?: number): OperatorFunction<T, R>;\nexport function mergeMapTo<T, I, R>(observable: ObservableInput<I>, resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R, concurrent?: number): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to the same Observable which is merged multiple\n * times in the output Observable.\n *\n * <span class=\"informal\">It's like {@link mergeMap}, but maps each value always\n * to the same inner Observable.</span>\n *\n * <img src=\"./img/mergeMapTo.png\" width=\"100%\">\n *\n * Maps each source value to the given Observable `innerObservable` regardless\n * of the source value, and then merges those resulting Observables into one\n * single Observable, which is the output Observable.\n *\n * @example <caption>For each click event, start an interval Observable ticking every 1 second</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.mergeMapTo(Rx.Observable.interval(1000));\n * result.subscribe(x => console.log(x));\n *\n * @see {@link concatMapTo}\n * @see {@link merge}\n * @see {@link mergeAll}\n * @see {@link mergeMap}\n * @see {@link mergeScan}\n * @see {@link switchMapTo}\n *\n * @param {ObservableInput} innerObservable An Observable to replace each value from\n * the source Observable.\n * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]\n * A function to produce the value on the output Observable based on the values\n * and the indices of the source (outer) emission and the inner Observable\n * emission. The arguments passed to this function are:\n * - `outerValue`: the value that came from the source\n * - `innerValue`: the value that came from the projected Observable\n * - `outerIndex`: the \"index\" of the value that came from the source\n * - `innerIndex`: the \"index\" of the value from the projected Observable\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input\n * Observables being subscribed to concurrently.\n * @return {Observable} An Observable that emits items from the given\n * `innerObservable` (and optionally transformed through `resultSelector`) every\n * time a value is emitted on the source Observable.\n * @method mergeMapTo\n * @owner Observable\n */\nexport function mergeMapTo<T, I, R>(innerObservable: Observable<I>,\n resultSelector?: ((outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R) | number,\n concurrent: number = Number.POSITIVE_INFINITY): OperatorFunction<T, R> {\n if (typeof resultSelector === 'number') {\n concurrent = <number>resultSelector;\n resultSelector = null;\n }\n return (source: Observable<T>) => source.lift(new MergeMapToOperator(innerObservable, <any>resultSelector, concurrent));\n}\n\n// TODO: Figure out correct signature here: an Operator<Observable<T>, R>\n// needs to implement call(observer: Subscriber<R>): Subscriber<Observable<T>>\nexport class MergeMapToOperator<T, I, R> implements Operator<Observable<T>, R> {\n constructor(private ish: ObservableInput<I>,\n private resultSelector?: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R,\n private concurrent: number = Number.POSITIVE_INFINITY) {\n }\n\n call(observer: Subscriber<R>, source: any): any {\n return source.subscribe(new MergeMapToSubscriber(observer, this.ish, this.resultSelector, this.concurrent));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class MergeMapToSubscriber<T, I, R> extends OuterSubscriber<T, I> {\n private hasCompleted: boolean = false;\n private buffer: T[] = [];\n private active: number = 0;\n protected index: number = 0;\n\n constructor(destination: Subscriber<R>,\n private ish: ObservableInput<I>,\n private resultSelector?: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R,\n private concurrent: number = Number.POSITIVE_INFINITY) {\n super(destination);\n }\n\n protected _next(value: T): void {\n if (this.active < this.concurrent) {\n const resultSelector = this.resultSelector;\n const index = this.index++;\n const ish = this.ish;\n const destination = this.destination;\n\n this.active++;\n this._innerSub(ish, destination, resultSelector, value, index);\n } else {\n this.buffer.push(value);\n }\n }\n\n private _innerSub(ish: ObservableInput<I>,\n destination: PartialObserver<I>,\n resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R,\n value: T,\n index: number): void {\n this.add(subscribeToResult<T, I>(this, ish, value, index));\n }\n\n protected _complete(): void {\n this.hasCompleted = true;\n if (this.active === 0 && this.buffer.length === 0) {\n this.destination.complete();\n }\n }\n\n notifyNext(outerValue: T, innerValue: I,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber<T, I>): void {\n const { resultSelector, destination } = this;\n if (resultSelector) {\n this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex);\n } else {\n destination.next(innerValue);\n }\n }\n\n private trySelectResult(outerValue: T, innerValue: I,\n outerIndex: number, innerIndex: number): void {\n const { resultSelector, destination } = this;\n let result: R;\n try {\n result = resultSelector(outerValue, innerValue, outerIndex, innerIndex);\n } catch (err) {\n destination.error(err);\n return;\n }\n\n destination.next(result);\n }\n\n notifyError(err: any): void {\n this.destination.error(err);\n }\n\n notifyComplete(innerSub: Subscription): void {\n const buffer = this.buffer;\n this.remove(innerSub);\n this.active--;\n if (buffer.length > 0) {\n this._next(buffer.shift());\n } else if (this.active === 0 && this.hasCompleted) {\n this.destination.complete();\n }\n }\n}\n"]}