skipLast.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var operators_1 = require("rxjs/operators");
  4. /**
  5. * Skip the last `count` values emitted by the source Observable.
  6. *
  7. * <img src="./img/skipLast.png" width="100%">
  8. *
  9. * `skipLast` returns an Observable that accumulates a queue with a length
  10. * enough to store the first `count` values. As more values are received,
  11. * values are taken from the front of the queue and produced on the result
  12. * sequence. This causes values to be delayed.
  13. *
  14. * @example <caption>Skip the last 2 values of an Observable with many values</caption>
  15. * var many = Rx.Observable.range(1, 5);
  16. * var skipLastTwo = many.skipLast(2);
  17. * skipLastTwo.subscribe(x => console.log(x));
  18. *
  19. * // Results in:
  20. * // 1 2 3
  21. *
  22. * @see {@link skip}
  23. * @see {@link skipUntil}
  24. * @see {@link skipWhile}
  25. * @see {@link take}
  26. *
  27. * @throws {ArgumentOutOfRangeError} When using `skipLast(i)`, it throws
  28. * ArgumentOutOrRangeError if `i < 0`.
  29. *
  30. * @param {number} count Number of elements to skip from the end of the source Observable.
  31. * @returns {Observable<T>} An Observable that skips the last count values
  32. * emitted by the source Observable.
  33. * @method skipLast
  34. * @owner Observable
  35. */
  36. function skipLast(count) {
  37. return operators_1.skipLast(count)(this);
  38. }
  39. exports.skipLast = skipLast;
  40. //# sourceMappingURL=skipLast.js.map