Front end of the Slack clone application.

take.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. var take_1 = require('../operators/take');
  3. /**
  4. * Emits only the first `count` values emitted by the source Observable.
  5. *
  6. * <span class="informal">Takes the first `count` values from the source, then
  7. * completes.</span>
  8. *
  9. * <img src="./img/take.png" width="100%">
  10. *
  11. * `take` returns an Observable that emits only the first `count` values emitted
  12. * by the source Observable. If the source emits fewer than `count` values then
  13. * all of its values are emitted. After that, it completes, regardless if the
  14. * source completes.
  15. *
  16. * @example <caption>Take the first 5 seconds of an infinite 1-second interval Observable</caption>
  17. * var interval = Rx.Observable.interval(1000);
  18. * var five = interval.take(5);
  19. * five.subscribe(x => console.log(x));
  20. *
  21. * @see {@link takeLast}
  22. * @see {@link takeUntil}
  23. * @see {@link takeWhile}
  24. * @see {@link skip}
  25. *
  26. * @throws {ArgumentOutOfRangeError} When using `take(i)`, it delivers an
  27. * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.
  28. *
  29. * @param {number} count The maximum number of `next` values to emit.
  30. * @return {Observable<T>} An Observable that emits only the first `count`
  31. * values emitted by the source Observable, or all of the values from the source
  32. * if the source emits fewer than `count` values.
  33. * @method take
  34. * @owner Observable
  35. */
  36. function take(count) {
  37. return take_1.take(count)(this);
  38. }
  39. exports.take = take;
  40. //# sourceMappingURL=take.js.map