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

takeUntil.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. }
  9. return function (d, b) {
  10. extendStatics(d, b);
  11. function __() { this.constructor = d; }
  12. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13. };
  14. })();
  15. Object.defineProperty(exports, "__esModule", { value: true });
  16. var innerSubscribe_1 = require("../innerSubscribe");
  17. function takeUntil(notifier) {
  18. return function (source) { return source.lift(new TakeUntilOperator(notifier)); };
  19. }
  20. exports.takeUntil = takeUntil;
  21. var TakeUntilOperator = (function () {
  22. function TakeUntilOperator(notifier) {
  23. this.notifier = notifier;
  24. }
  25. TakeUntilOperator.prototype.call = function (subscriber, source) {
  26. var takeUntilSubscriber = new TakeUntilSubscriber(subscriber);
  27. var notifierSubscription = innerSubscribe_1.innerSubscribe(this.notifier, new innerSubscribe_1.SimpleInnerSubscriber(takeUntilSubscriber));
  28. if (notifierSubscription && !takeUntilSubscriber.seenValue) {
  29. takeUntilSubscriber.add(notifierSubscription);
  30. return source.subscribe(takeUntilSubscriber);
  31. }
  32. return takeUntilSubscriber;
  33. };
  34. return TakeUntilOperator;
  35. }());
  36. var TakeUntilSubscriber = (function (_super) {
  37. __extends(TakeUntilSubscriber, _super);
  38. function TakeUntilSubscriber(destination) {
  39. var _this = _super.call(this, destination) || this;
  40. _this.seenValue = false;
  41. return _this;
  42. }
  43. TakeUntilSubscriber.prototype.notifyNext = function () {
  44. this.seenValue = true;
  45. this.complete();
  46. };
  47. TakeUntilSubscriber.prototype.notifyComplete = function () {
  48. };
  49. return TakeUntilSubscriber;
  50. }(innerSubscribe_1.SimpleOuterSubscriber));
  51. //# sourceMappingURL=takeUntil.js.map