a zip code crypto-currency system good for red ONLY

SubjectSubscription.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /** PURE_IMPORTS_START ._Subscription PURE_IMPORTS_END */
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b)
  4. if (b.hasOwnProperty(p))
  5. d[p] = b[p];
  6. function __() { this.constructor = d; }
  7. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8. };
  9. import { Subscription } from './Subscription';
  10. /**
  11. * We need this JSDoc comment for affecting ESDoc.
  12. * @ignore
  13. * @extends {Ignored}
  14. */
  15. export var SubjectSubscription = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  16. __extends(SubjectSubscription, _super);
  17. function SubjectSubscription(subject, subscriber) {
  18. _super.call(this);
  19. this.subject = subject;
  20. this.subscriber = subscriber;
  21. this.closed = false;
  22. }
  23. SubjectSubscription.prototype.unsubscribe = function () {
  24. if (this.closed) {
  25. return;
  26. }
  27. this.closed = true;
  28. var subject = this.subject;
  29. var observers = subject.observers;
  30. this.subject = null;
  31. if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
  32. return;
  33. }
  34. var subscriberIndex = observers.indexOf(this.subscriber);
  35. if (subscriberIndex !== -1) {
  36. observers.splice(subscriberIndex, 1);
  37. }
  38. };
  39. return SubjectSubscription;
  40. }(Subscription));
  41. //# sourceMappingURL=SubjectSubscription.js.map