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

SubjectSubscription.js 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. /** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { Subscription } from './Subscription';
  4. var SubjectSubscription = /*@__PURE__*/ (function (_super) {
  5. tslib_1.__extends(SubjectSubscription, _super);
  6. function SubjectSubscription(subject, subscriber) {
  7. var _this = _super.call(this) || this;
  8. _this.subject = subject;
  9. _this.subscriber = subscriber;
  10. _this.closed = false;
  11. return _this;
  12. }
  13. SubjectSubscription.prototype.unsubscribe = function () {
  14. if (this.closed) {
  15. return;
  16. }
  17. this.closed = true;
  18. var subject = this.subject;
  19. var observers = subject.observers;
  20. this.subject = null;
  21. if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
  22. return;
  23. }
  24. var subscriberIndex = observers.indexOf(this.subscriber);
  25. if (subscriberIndex !== -1) {
  26. observers.splice(subscriberIndex, 1);
  27. }
  28. };
  29. return SubjectSubscription;
  30. }(Subscription));
  31. export { SubjectSubscription };
  32. //# sourceMappingURL=SubjectSubscription.js.map