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

1 line
9.8 KiB
Plaintext

{"version":3,"file":"expand.js","sourceRoot":"","sources":["../../src/operators/expand.ts"],"names":[],"mappings":";;;;;;AAIA,yBAAyB,kBAAkB,CAAC,CAAA;AAC5C,4BAA4B,qBAAqB,CAAC,CAAA;AAElD,gCAAgC,oBAAoB,CAAC,CAAA;AAErD,kCAAkC,2BAA2B,CAAC,CAAA;AAM9D,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,gBAA6B,OAAmD,EACnD,UAA6C,EAC7C,SAAiC;IADjC,0BAA6C,GAA7C,aAAqB,MAAM,CAAC,iBAAiB;IAC7C,yBAAiC,GAAjC,qBAAiC;IAC5D,UAAU,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,iBAAiB,GAAG,UAAU,CAAC;IAE3E,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,EAA/D,CAA+D,CAAC;AACpG,CAAC;AANe,cAAM,SAMrB,CAAA;AAED;IACE,wBAAoB,OAAmD,EACnD,UAAkB,EAClB,SAAqB;QAFrB,YAAO,GAAP,OAAO,CAA4C;QACnD,eAAU,GAAV,UAAU,CAAQ;QAClB,cAAS,GAAT,SAAS,CAAY;IACzC,CAAC;IAED,6BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3G,CAAC;IACH,qBAAC;AAAD,CAAC,AATD,IASC;AATY,sBAAc,iBAS1B,CAAA;AASD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AC,MAAM,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YAC3C,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IACH,uBAAC;AAAD,CAAC,AA3ED,CAA4C,iCAAe,GA2E1D;AA3EY,wBAAgB,mBA2E5B,CAAA","sourcesContent":["import { Observable } from '../Observable';\nimport { IScheduler } from '../Scheduler';\nimport { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { tryCatch } from '../util/tryCatch';\nimport { errorObject } from '../util/errorObject';\nimport { Subscription } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { MonoTypeOperatorFunction, OperatorFunction } from '../interfaces';\n\n/* tslint:disable:max-line-length */\nexport function expand<T>(project: (value: T, index: number) => Observable<T>, concurrent?: number, scheduler?: IScheduler): MonoTypeOperatorFunction<T>;\nexport function expand<T, R>(project: (value: T, index: number) => Observable<R>, concurrent?: number, scheduler?: IScheduler): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Recursively projects each source value to an Observable which is merged in\n * the output Observable.\n *\n * <span class=\"informal\">It's similar to {@link mergeMap}, but applies the\n * projection function to every source value as well as every output value.\n * It's recursive.</span>\n *\n * <img src=\"./img/expand.png\" width=\"100%\">\n *\n * Returns an Observable that emits items based on applying a function that you\n * supply to each item emitted by the source Observable, where that function\n * returns an Observable, and then merging those resulting Observables and\n * emitting the results of this merger. *Expand* will re-emit on the output\n * Observable every source value. Then, each output value is given to the\n * `project` function which returns an inner Observable to be merged on the\n * output Observable. Those output values resulting from the projection are also\n * given to the `project` function to produce new output values. This is how\n * *expand* behaves recursively.\n *\n * @example <caption>Start emitting the powers of two on every click, at most 10 of them</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var powersOfTwo = clicks\n * .mapTo(1)\n * .expand(x => Rx.Observable.of(2 * x).delay(1000))\n * .take(10);\n * powersOfTwo.subscribe(x => console.log(x));\n *\n * @see {@link mergeMap}\n * @see {@link mergeScan}\n *\n * @param {function(value: T, index: number) => Observable} project A function\n * that, when applied to an item emitted by the source or the output Observable,\n * returns an Observable.\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input\n * Observables being subscribed to concurrently.\n * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to\n * each projected inner Observable.\n * @return {Observable} An Observable that emits the source values and also\n * result of applying the projection function to each value emitted on the\n * output Observable and and merging the results of the Observables obtained\n * from this transformation.\n * @method expand\n * @owner Observable\n */\nexport function expand<T, R>(project: (value: T, index: number) => Observable<R>,\n concurrent: number = Number.POSITIVE_INFINITY,\n scheduler: IScheduler = undefined): OperatorFunction<T, R> {\n concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;\n\n return (source: Observable<T>) => source.lift(new ExpandOperator(project, concurrent, scheduler));\n}\n\nexport class ExpandOperator<T, R> implements Operator<T, R> {\n constructor(private project: (value: T, index: number) => Observable<R>,\n private concurrent: number,\n private scheduler: IScheduler) {\n }\n\n call(subscriber: Subscriber<R>, source: any): any {\n return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler));\n }\n}\n\ninterface DispatchArg<T, R> {\n subscriber: ExpandSubscriber<T, R>;\n result: Observable<R>;\n value: any;\n index: number;\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class ExpandSubscriber<T, R> extends OuterSubscriber<T, R> {\n private index: number = 0;\n private active: number = 0;\n private hasCompleted: boolean = false;\n private buffer: any[];\n\n constructor(destination: Subscriber<R>,\n private project: (value: T, index: number) => Observable<R>,\n private concurrent: number,\n private scheduler: IScheduler) {\n super(destination);\n if (concurrent < Number.POSITIVE_INFINITY) {\n this.buffer = [];\n }\n }\n\n private static dispatch<T, R>(arg: DispatchArg<T, R>): void {\n const {subscriber, result, value, index} = arg;\n subscriber.subscribeToProjection(result, value, index);\n }\n\n protected _next(value: any): void {\n const destination = this.destination;\n\n if (destination.closed) {\n this._complete();\n return;\n }\n\n const index = this.index++;\n if (this.active < this.concurrent) {\n destination.next(value);\n let result = tryCatch(this.project)(value, index);\n if (result === errorObject) {\n destination.error(errorObject.e);\n } else if (!this.scheduler) {\n this.subscribeToProjection(result, value, index);\n } else {\n const state: DispatchArg<T, R> = { subscriber: this, result, value, index };\n this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));\n }\n } else {\n this.buffer.push(value);\n }\n }\n\n private subscribeToProjection(result: any, value: T, index: number): void {\n this.active++;\n this.add(subscribeToResult<T, R>(this, result, value, index));\n }\n\n protected _complete(): void {\n this.hasCompleted = true;\n if (this.hasCompleted && this.active === 0) {\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 this._next(innerValue);\n }\n\n notifyComplete(innerSub: Subscription): void {\n const buffer = this.buffer;\n this.remove(innerSub);\n this.active--;\n if (buffer && buffer.length > 0) {\n this._next(buffer.shift());\n }\n if (this.hasCompleted && this.active === 0) {\n this.destination.complete();\n }\n }\n}\n"]}