{"version":3,"file":"switchMapTo.js","sourceRoot":"","sources":["../../src/operator/switchMapTo.ts"],"names":[],"mappings":";AACA,4BAA2C,0BAA0B,CAAC,CAAA;AAKtE,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBAA0D,eAA8B,EACnD,cAG0C;IAC7E,MAAM,CAAC,yBAAW,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC;AANe,mBAAW,cAM1B,CAAA","sourcesContent":["import { Observable, ObservableInput } from '../Observable';\nimport { switchMapTo as higherOrder } from '../operators/switchMapTo';\n\n/* tslint:disable:max-line-length */\nexport function switchMapTo(this: Observable, observable: ObservableInput): Observable;\nexport function switchMapTo(this: Observable, observable: ObservableInput, resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R): Observable;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to the same Observable which is flattened multiple\n * times with {@link switch} in the output Observable.\n *\n * It's like {@link switchMap}, but maps each value\n * always to the same inner Observable.\n *\n * \n *\n * Maps each source value to the given Observable `innerObservable` regardless\n * of the source value, and then flattens those resulting Observables into one\n * single Observable, which is the output Observable. The output Observables\n * emits values only from the most recently emitted instance of\n * `innerObservable`.\n *\n * @example Rerun an interval Observable on every click event\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.switchMapTo(Rx.Observable.interval(1000));\n * result.subscribe(x => console.log(x));\n *\n * @see {@link concatMapTo}\n * @see {@link switch}\n * @see {@link switchMap}\n * @see {@link mergeMapTo}\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 * @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, and taking only the values\n * from the most recently projected inner Observable.\n * @method switchMapTo\n * @owner Observable\n */\nexport function switchMapTo(this: Observable, innerObservable: Observable,\n resultSelector?: (outerValue: T,\n innerValue: I,\n outerIndex: number,\n innerIndex: number) => R): Observable {\n return higherOrder(innerObservable, resultSelector)(this);\n}\n"]}