skip.js 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { Subscriber } from '../Subscriber';
  4. export function skip(count) {
  5. return function (source) { return source.lift(new SkipOperator(count)); };
  6. }
  7. var SkipOperator = /*@__PURE__*/ (function () {
  8. function SkipOperator(total) {
  9. this.total = total;
  10. }
  11. SkipOperator.prototype.call = function (subscriber, source) {
  12. return source.subscribe(new SkipSubscriber(subscriber, this.total));
  13. };
  14. return SkipOperator;
  15. }());
  16. var SkipSubscriber = /*@__PURE__*/ (function (_super) {
  17. tslib_1.__extends(SkipSubscriber, _super);
  18. function SkipSubscriber(destination, total) {
  19. var _this = _super.call(this, destination) || this;
  20. _this.total = total;
  21. _this.count = 0;
  22. return _this;
  23. }
  24. SkipSubscriber.prototype._next = function (x) {
  25. if (++this.count > this.total) {
  26. this.destination.next(x);
  27. }
  28. };
  29. return SkipSubscriber;
  30. }(Subscriber));
  31. //# sourceMappingURL=skip.js.map