mergeMapTo.d.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { Observable, ObservableInput } from 'rxjs';
  2. /**
  3. * Projects each source value to the same Observable which is merged multiple
  4. * times in the output Observable.
  5. *
  6. * <span class="informal">It's like {@link mergeMap}, but maps each value always
  7. * to the same inner Observable.</span>
  8. *
  9. * <img src="./img/mergeMapTo.png" width="100%">
  10. *
  11. * Maps each source value to the given Observable `innerObservable` regardless
  12. * of the source value, and then merges those resulting Observables into one
  13. * single Observable, which is the output Observable.
  14. *
  15. * @example <caption>For each click event, start an interval Observable ticking every 1 second</caption>
  16. * var clicks = Rx.Observable.fromEvent(document, 'click');
  17. * var result = clicks.mergeMapTo(Rx.Observable.interval(1000));
  18. * result.subscribe(x => console.log(x));
  19. *
  20. * @see {@link concatMapTo}
  21. * @see {@link merge}
  22. * @see {@link mergeAll}
  23. * @see {@link mergeMap}
  24. * @see {@link mergeScan}
  25. * @see {@link switchMapTo}
  26. *
  27. * @param {ObservableInput} innerObservable An Observable to replace each value from
  28. * the source Observable.
  29. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
  30. * Observables being subscribed to concurrently.
  31. * @return {Observable} An Observable that emits items from the given
  32. * `innerObservable`.
  33. * @method mergeMapTo
  34. * @owner Observable
  35. */
  36. export declare function mergeMapTo<T, R>(this: Observable<T>, innerObservable: ObservableInput<R>, concurrent?: number): Observable<R>;