Front end of the Slack clone application.

exhaust.js 1.7KB

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