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

takeUntil.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /** PURE_IMPORTS_START tslib,_innerSubscribe PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { innerSubscribe, SimpleInnerSubscriber, SimpleOuterSubscriber } from '../innerSubscribe';
  4. export function takeUntil(notifier) {
  5. return function (source) { return source.lift(new TakeUntilOperator(notifier)); };
  6. }
  7. var TakeUntilOperator = /*@__PURE__*/ (function () {
  8. function TakeUntilOperator(notifier) {
  9. this.notifier = notifier;
  10. }
  11. TakeUntilOperator.prototype.call = function (subscriber, source) {
  12. var takeUntilSubscriber = new TakeUntilSubscriber(subscriber);
  13. var notifierSubscription = innerSubscribe(this.notifier, new SimpleInnerSubscriber(takeUntilSubscriber));
  14. if (notifierSubscription && !takeUntilSubscriber.seenValue) {
  15. takeUntilSubscriber.add(notifierSubscription);
  16. return source.subscribe(takeUntilSubscriber);
  17. }
  18. return takeUntilSubscriber;
  19. };
  20. return TakeUntilOperator;
  21. }());
  22. var TakeUntilSubscriber = /*@__PURE__*/ (function (_super) {
  23. tslib_1.__extends(TakeUntilSubscriber, _super);
  24. function TakeUntilSubscriber(destination) {
  25. var _this = _super.call(this, destination) || this;
  26. _this.seenValue = false;
  27. return _this;
  28. }
  29. TakeUntilSubscriber.prototype.notifyNext = function () {
  30. this.seenValue = true;
  31. this.complete();
  32. };
  33. TakeUntilSubscriber.prototype.notifyComplete = function () {
  34. };
  35. return TakeUntilSubscriber;
  36. }(SimpleOuterSubscriber));
  37. //# sourceMappingURL=takeUntil.js.map