Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

skip.js 643B

12345678910111213141516171819202122232425
  1. import { Subscriber } from '../Subscriber';
  2. export function skip(count) {
  3. return (source) => source.lift(new SkipOperator(count));
  4. }
  5. class SkipOperator {
  6. constructor(total) {
  7. this.total = total;
  8. }
  9. call(subscriber, source) {
  10. return source.subscribe(new SkipSubscriber(subscriber, this.total));
  11. }
  12. }
  13. class SkipSubscriber extends Subscriber {
  14. constructor(destination, total) {
  15. super(destination);
  16. this.total = total;
  17. this.count = 0;
  18. }
  19. _next(x) {
  20. if (++this.count > this.total) {
  21. this.destination.next(x);
  22. }
  23. }
  24. }
  25. //# sourceMappingURL=skip.js.map