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

1 line
11 KiB
Plaintext

{"version":3,"file":"combineLatest.js","sourceRoot":"","sources":["../../src/operators/combineLatest.ts"],"names":[],"mappings":";;;;;;AACA,gCAAgC,+BAA+B,CAAC,CAAA;AAChE,wBAAwB,iBAAiB,CAAC,CAAA;AAG1C,gCAAgC,oBAAoB,CAAC,CAAA;AAErD,kCAAkC,2BAA2B,CAAC,CAAA;AAG9D,IAAM,IAAI,GAAG,EAAE,CAAC;AAiBhB,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH;IAAoC,qBAE+C;SAF/C,WAE+C,CAF/C,sBAE+C,CAF/C,IAE+C;QAF/C,oCAE+C;;IACjF,IAAI,OAAO,GAAiC,IAAI,CAAC;IACjD,EAAE,CAAC,CAAC,OAAO,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;QAC9D,OAAO,GAAiC,WAAW,CAAC,GAAG,EAAE,CAAC;IAC5D,CAAC;IAED,8EAA8E;IAC9E,4EAA4E;IAC5E,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,iBAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,WAAW,GAAS,WAAW,CAAC,CAAC,CAAE,CAAC,KAAK,EAAE,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,iCAAe,CAAC,CAAC,MAAM,SAAK,WAAW,CAAC,CAAC,EAAE,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC,EAAnG,CAAmG,CAAC;AACxI,CAAC;AAfe,qBAAa,gBAe5B,CAAA;AAED;IACE,+BAAoB,OAAsC;QAAtC,YAAO,GAAP,OAAO,CAA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G,CAAC,CAAC;YAC5B,MAAM,CAAC;QACT,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACH,8BAAC;AAAD,CAAC,AAjED,CAAmD,iCAAe,GAiEjE;AAjEY,+BAAuB,0BAiEnC,CAAA","sourcesContent":["import { Observable, ObservableInput } from '../Observable';\nimport { ArrayObservable } from '../observable/ArrayObservable';\nimport { isArray } from '../util/isArray';\nimport { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OperatorFunction } from '../interfaces';\n\nconst none = {};\n\n/* tslint:disable:max-line-length */\nexport function combineLatest<T, R>(project: (v1: T) => R): OperatorFunction<T, R>;\nexport function combineLatest<T, T2, R>(v2: ObservableInput<T2>, project: (v1: T, v2: T2) => R): OperatorFunction<T, R>;\nexport function combineLatest<T, T2, T3, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, project: (v1: T, v2: T2, v3: T3) => R): OperatorFunction<T, R>;\nexport function combineLatest<T, T2, T3, T4, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, project: (v1: T, v2: T2, v3: T3, v4: T4) => R): OperatorFunction<T, R>;\nexport function combineLatest<T, T2, T3, T4, T5, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => R): OperatorFunction<T, R>;\nexport function combineLatest<T, T2, T3, T4, T5, T6, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => R): OperatorFunction<T, R> ;\nexport function combineLatest<T, T2>(v2: ObservableInput<T2>): OperatorFunction<T, [T, T2]>;\nexport function combineLatest<T, T2, T3>(v2: ObservableInput<T2>, v3: ObservableInput<T3>): OperatorFunction<T, [T, T2, T3]>;\nexport function combineLatest<T, T2, T3, T4>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>): OperatorFunction<T, [T, T2, T3, T4]>;\nexport function combineLatest<T, T2, T3, T4, T5>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>): OperatorFunction<T, [T, T2, T3, T4, T5]>;\nexport function combineLatest<T, T2, T3, T4, T5, T6>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>): OperatorFunction<T, [T, T2, T3, T4, T5, T6]> ;\nexport function combineLatest<T, R>(...observables: Array<ObservableInput<T> | ((...values: Array<T>) => R)>): OperatorFunction<T, R>;\nexport function combineLatest<T, R>(array: ObservableInput<T>[]): OperatorFunction<T, Array<T>>;\nexport function combineLatest<T, TOther, R>(array: ObservableInput<TOther>[], project: (v1: T, ...values: Array<TOther>) => R): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Combines multiple Observables to create an Observable whose values are\n * calculated from the latest values of each of its input Observables.\n *\n * <span class=\"informal\">Whenever any input Observable emits a value, it\n * computes a formula using the latest values from all the inputs, then emits\n * the output of that formula.</span>\n *\n * <img src=\"./img/combineLatest.png\" width=\"100%\">\n *\n * `combineLatest` combines the values from this Observable with values from\n * Observables passed as arguments. This is done by subscribing to each\n * Observable, in order, and collecting an array of each of the most recent\n * values any time any of the input Observables emits, then either taking that\n * array and passing it as arguments to an optional `project` function and\n * emitting the return value of that, or just emitting the array of recent\n * values directly if there is no `project` function.\n *\n * @example <caption>Dynamically calculate the Body-Mass Index from an Observable of weight and one for height</caption>\n * var weight = Rx.Observable.of(70, 72, 76, 79, 75);\n * var height = Rx.Observable.of(1.76, 1.77, 1.78);\n * var bmi = weight.combineLatest(height, (w, h) => w / (h * h));\n * bmi.subscribe(x => console.log('BMI is ' + x));\n *\n * // With output to console:\n * // BMI is 24.212293388429753\n * // BMI is 23.93948099205209\n * // BMI is 23.671253629592222\n *\n * @see {@link combineAll}\n * @see {@link merge}\n * @see {@link withLatestFrom}\n *\n * @param {ObservableInput} other An input Observable to combine with the source\n * Observable. More than one input Observables may be given as argument.\n * @param {function} [project] An optional function to project the values from\n * the combined latest values into a new value on the output Observable.\n * @return {Observable} An Observable of projected values from the most recent\n * values from each input Observable, or an array of the most recent values from\n * each input Observable.\n * @method combineLatest\n * @owner Observable\n */\nexport function combineLatest<T, R>(...observables: Array<ObservableInput<any> |\n Array<ObservableInput<any>> |\n ((...values: Array<any>) => R)>): OperatorFunction<T, R> {\n let project: (...values: Array<any>) => R = null;\n if (typeof observables[observables.length - 1] === 'function') {\n project = <(...values: Array<any>) => R>observables.pop();\n }\n\n // if the first and only other argument besides the resultSelector is an array\n // assume it's been called with `combineLatest([obs1, obs2, obs3], project)`\n if (observables.length === 1 && isArray(observables[0])) {\n observables = (<any>observables[0]).slice();\n }\n\n return (source: Observable<T>) => source.lift.call(new ArrayObservable([source, ...observables]), new CombineLatestOperator(project));\n}\n\nexport class CombineLatestOperator<T, R> implements Operator<T, R> {\n constructor(private project?: (...values: Array<any>) => R) {\n }\n\n call(subscriber: Subscriber<R>, source: any): any {\n return source.subscribe(new CombineLatestSubscriber(subscriber, this.project));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class CombineLatestSubscriber<T, R> extends OuterSubscriber<T, R> {\n private active: number = 0;\n private values: any[] = [];\n private observables: any[] = [];\n private toRespond: number;\n\n constructor(destination: Subscriber<R>, private project?: (...values: Array<any>) => R) {\n super(destination);\n }\n\n protected _next(observable: any) {\n this.values.push(none);\n this.observables.push(observable);\n }\n\n protected _complete() {\n const observables = this.observables;\n const len = observables.length;\n if (len === 0) {\n this.destination.complete();\n } else {\n this.active = len;\n this.toRespond = len;\n for (let i = 0; i < len; i++) {\n const observable = observables[i];\n this.add(subscribeToResult(this, observable, observable, i));\n }\n }\n }\n\n notifyComplete(unused: Subscriber<R>): void {\n if ((this.active -= 1) === 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 const values = this.values;\n const oldVal = values[outerIndex];\n const toRespond = !this.toRespond\n ? 0\n : oldVal === none ? --this.toRespond : this.toRespond;\n values[outerIndex] = innerValue;\n\n if (toRespond === 0) {\n if (this.project) {\n this._tryProject(values);\n } else {\n this.destination.next(values.slice());\n }\n }\n }\n\n private _tryProject(values: any[]) {\n let result: any;\n try {\n result = this.project.apply(this, values);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n this.destination.next(result);\n }\n}\n"]}