1 |
- {"version":3,"file":"mergeScan.js","sourceRoot":"","sources":["../../src/operator/mergeScan.ts"],"names":[],"mappings":";AAEA,0BAAyC,wBAAwB,CAAC,CAAA;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,mBACgC,WAAgD,EAChD,IAAO,EACP,UAA6C;IAA7C,0BAA6C,GAA7C,aAAqB,MAAM,CAAC,iBAAiB;IAC3E,MAAM,CAAC,qBAAW,CAAC,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC;AALe,iBAAS,YAKxB,CAAA","sourcesContent":["\nimport { Observable } from '../Observable';\nimport { mergeScan as higherOrder } from '../operators/mergeScan';\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>(this: Observable<T>,\n accumulator: (acc: R, value: T) => Observable<R>,\n seed: R,\n concurrent: number = Number.POSITIVE_INFINITY): Observable<R> {\n return higherOrder(accumulator, seed, concurrent)(this);\n}\n"]}
|