Front end of the Slack clone application.

mergeScan.d.ts 1.3KB

12345678910111213141516171819202122232425262728293031323334
  1. import { Observable } from '../Observable';
  2. /**
  3. * Applies an accumulator function over the source Observable where the
  4. * accumulator function itself returns an Observable, then each intermediate
  5. * Observable returned is merged into the output Observable.
  6. *
  7. * <span class="informal">It's like {@link scan}, but the Observables returned
  8. * by the accumulator are merged into the outer Observable.</span>
  9. *
  10. * @example <caption>Count the number of click events</caption>
  11. * const click$ = Rx.Observable.fromEvent(document, 'click');
  12. * const one$ = click$.mapTo(1);
  13. * const seed = 0;
  14. * const count$ = one$.mergeScan((acc, one) => Rx.Observable.of(acc + one), seed);
  15. * count$.subscribe(x => console.log(x));
  16. *
  17. * // Results:
  18. * 1
  19. * 2
  20. * 3
  21. * 4
  22. * // ...and so on for each click
  23. *
  24. * @param {function(acc: R, value: T): Observable<R>} accumulator
  25. * The accumulator function called on each source value.
  26. * @param seed The initial accumulation value.
  27. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of
  28. * input Observables being subscribed to concurrently.
  29. * @return {Observable<R>} An observable of the accumulated values.
  30. * @method mergeScan
  31. * @owner Observable
  32. */
  33. export declare function mergeScan<T, R>(this: Observable<T>, accumulator: (acc: R, value: T) => Observable<R>, seed: R, concurrent?: number): Observable<R>;