Front end of the Slack clone application.

exhaust.d.ts 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { Observable } from '../Observable';
  2. /**
  3. * Converts a higher-order Observable into a first-order Observable by dropping
  4. * inner Observables while the previous inner Observable has not yet completed.
  5. *
  6. * <span class="informal">Flattens an Observable-of-Observables by dropping the
  7. * next inner Observables while the current inner is still executing.</span>
  8. *
  9. * <img src="./img/exhaust.png" width="100%">
  10. *
  11. * `exhaust` subscribes to an Observable that emits Observables, also known as a
  12. * higher-order Observable. Each time it observes one of these emitted inner
  13. * Observables, the output Observable begins emitting the items emitted by that
  14. * inner Observable. So far, it behaves like {@link mergeAll}. However,
  15. * `exhaust` ignores every new inner Observable if the previous Observable has
  16. * not yet completed. Once that one completes, it will accept and flatten the
  17. * next inner Observable and repeat this process.
  18. *
  19. * @example <caption>Run a finite timer for each click, only if there is no currently active timer</caption>
  20. * var clicks = Rx.Observable.fromEvent(document, 'click');
  21. * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5));
  22. * var result = higherOrder.exhaust();
  23. * result.subscribe(x => console.log(x));
  24. *
  25. * @see {@link combineAll}
  26. * @see {@link concatAll}
  27. * @see {@link switch}
  28. * @see {@link mergeAll}
  29. * @see {@link exhaustMap}
  30. * @see {@link zipAll}
  31. *
  32. * @return {Observable} An Observable that takes a source of Observables and propagates the first observable
  33. * exclusively until it completes before subscribing to the next.
  34. * @method exhaust
  35. * @owner Observable
  36. */
  37. export declare function exhaust<T>(this: Observable<T>): Observable<T>;