db7f25e88c40ed1951bd41c76811d9daf02ba3941425cf2bd29f78644c4accb567f652bf45881fb4426b02fa32489e1b0aa4be6ac64f6dae54d2c62d3fa82b 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { ObservableInputTuple, OperatorFunction } from '../types';
  2. /**
  3. * Merge the values from all observables to a single observable result.
  4. *
  5. * Creates an observable, that when subscribed to, subscribes to the source
  6. * observable, and all other sources provided as arguments. All values from
  7. * every source are emitted from the resulting subscription.
  8. *
  9. * When all sources complete, the resulting observable will complete.
  10. *
  11. * When any source errors, the resulting observable will error.
  12. *
  13. * ## Example
  14. *
  15. * Joining all outputs from multiple user input event streams
  16. *
  17. * ```ts
  18. * import { fromEvent, map, mergeWith } from 'rxjs';
  19. *
  20. * const clicks$ = fromEvent(document, 'click').pipe(map(() => 'click'));
  21. * const mousemoves$ = fromEvent(document, 'mousemove').pipe(map(() => 'mousemove'));
  22. * const dblclicks$ = fromEvent(document, 'dblclick').pipe(map(() => 'dblclick'));
  23. *
  24. * mousemoves$
  25. * .pipe(mergeWith(clicks$, dblclicks$))
  26. * .subscribe(x => console.log(x));
  27. *
  28. * // result (assuming user interactions)
  29. * // 'mousemove'
  30. * // 'mousemove'
  31. * // 'mousemove'
  32. * // 'click'
  33. * // 'click'
  34. * // 'dblclick'
  35. * ```
  36. *
  37. * @see {@link merge}
  38. *
  39. * @param otherSources the sources to combine the current source with.
  40. * @return A function that returns an Observable that merges the values from
  41. * all given Observables.
  42. */
  43. export declare function mergeWith<T, A extends readonly unknown[]>(...otherSources: [...ObservableInputTuple<A>]): OperatorFunction<T, T | A[number]>;
  44. //# sourceMappingURL=mergeWith.d.ts.map