biofriction-wp-theme/node_modules/rxjs/operators/mergeScan.js.map

1 line
7.6 KiB
Plaintext

{"version":3,"file":"mergeScan.js","sourceRoot":"","sources":["../../src/operators/mergeScan.ts"],"names":[],"mappings":";;;;;;AAIA,yBAAyB,kBAAkB,CAAC,CAAA;AAC5C,4BAA4B,qBAAqB,CAAC,CAAA;AAClD,kCAAkC,2BAA2B,CAAC,CAAA;AAC9D,gCAAgC,oBAAoB,CAAC,CAAA;AAIrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,mBAAgC,WAAgD,EAChD,IAAO,EACP,UAA6C;IAA7C,0BAA6C,GAA7C,aAAqB,MAAM,CAAC,iBAAiB;IAC3E,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,EAAjE,CAAiE,CAAC;AACtG,CAAC;AAJe,iBAAS,YAIxB,CAAA;AAED;IACE,2BAAoB,WAAgD,EAChD,IAAO,EACP,UAAkB;QAFlB,gBAAW,GAAX,WAAW,CAAqC;QAChD,SAAI,GAAJ,IAAI,CAAG;QACP,eAAU,GAAV,UAAU,CAAQ;IACtC,CAAC;IAED,gCAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,mBAAmB,CAC7C,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CACzD,CAAC,CAAC;IACL,CAAC;IACH,wBAAC;AAAD,CAAC,AAXD,IAWC;AAXY,yBAAiB,oBAW7B,CAAA;AAED;;;;GAIG;AACH;IAA+C,uCAAqB;IAOlE,6BAAY,WAA0B,EAClB,WAAgD,EAChD,GAAM,EACN,UAAkB;QACpC,kBAAM,WAAW,CAAC,CAAC;QAHD,gBAAW,GAAX,WAAW,CAAqC;QAChD,QAAG,GAAH,GAA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ED,CAA+C,iCAAe,GAkE7D;AAlEY,2BAAmB,sBAkE/B,CAAA","sourcesContent":["import { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { tryCatch } from '../util/tryCatch';\nimport { errorObject } from '../util/errorObject';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { OperatorFunction } from '../interfaces';\n\n/**\n * Applies an accumulator function over the source Observable where the\n * accumulator function itself returns an Observable, then each intermediate\n * Observable returned is merged into the output Observable.\n *\n * <span class=\"informal\">It's like {@link scan}, but the Observables returned\n * by the accumulator are merged into the outer Observable.</span>\n *\n * @example <caption>Count the number of click events</caption>\n * const click$ = Rx.Observable.fromEvent(document, 'click');\n * const one$ = click$.mapTo(1);\n * const seed = 0;\n * const count$ = one$.mergeScan((acc, one) => Rx.Observable.of(acc + one), seed);\n * count$.subscribe(x => console.log(x));\n *\n * // Results:\n * 1\n * 2\n * 3\n * 4\n * // ...and so on for each click\n *\n * @param {function(acc: R, value: T): Observable<R>} accumulator\n * The accumulator function called on each source value.\n * @param seed The initial accumulation value.\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of\n * input Observables being subscribed to concurrently.\n * @return {Observable<R>} An observable of the accumulated values.\n * @method mergeScan\n * @owner Observable\n */\nexport function mergeScan<T, R>(accumulator: (acc: R, value: T) => Observable<R>,\n seed: R,\n concurrent: number = Number.POSITIVE_INFINITY): OperatorFunction<T, R> {\n return (source: Observable<T>) => source.lift(new MergeScanOperator(accumulator, seed, concurrent));\n}\n\nexport class MergeScanOperator<T, R> implements Operator<T, R> {\n constructor(private accumulator: (acc: R, value: T) => Observable<R>,\n private seed: R,\n private concurrent: number) {\n }\n\n call(subscriber: Subscriber<R>, source: any): any {\n return source.subscribe(new MergeScanSubscriber(\n subscriber, this.accumulator, this.seed, this.concurrent\n ));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class MergeScanSubscriber<T, R> extends OuterSubscriber<T, R> {\n private hasValue: boolean = false;\n private hasCompleted: boolean = false;\n private buffer: Observable<any>[] = [];\n private active: number = 0;\n protected index: number = 0;\n\n constructor(destination: Subscriber<R>,\n private accumulator: (acc: R, value: T) => Observable<R>,\n private acc: R,\n private concurrent: number) {\n super(destination);\n }\n\n protected _next(value: any): void {\n if (this.active < this.concurrent) {\n const index = this.index++;\n const ish = tryCatch(this.accumulator)(this.acc, value);\n const destination = this.destination;\n if (ish === errorObject) {\n destination.error(errorObject.e);\n } else {\n this.active++;\n this._innerSub(ish, value, index);\n }\n } else {\n this.buffer.push(value);\n }\n }\n\n private _innerSub(ish: any, value: T, index: number): void {\n this.add(subscribeToResult<T, R>(this, ish, value, index));\n }\n\n protected _complete(): void {\n this.hasCompleted = true;\n if (this.active === 0 && this.buffer.length === 0) {\n if (this.hasValue === false) {\n this.destination.next(this.acc);\n }\n this.destination.complete();\n }\n }\n\n notifyNext(outerValue: T, innerValue: R,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber<T, R>): void {\n const { destination } = this;\n this.acc = innerValue;\n this.hasValue = true;\n destination.next(innerValue);\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 if (this.hasValue === false) {\n this.destination.next(this.acc);\n }\n this.destination.complete();\n }\n }\n}\n"]}