a zip code crypto-currency system good for red ONLY

SubjectSubscription.js 915B

12345678910111213141516171819202122232425262728293031
  1. import { Subscription } from './Subscription';
  2. /**
  3. * We need this JSDoc comment for affecting ESDoc.
  4. * @ignore
  5. * @extends {Ignored}
  6. */
  7. export class SubjectSubscription extends Subscription {
  8. constructor(subject, subscriber) {
  9. super();
  10. this.subject = subject;
  11. this.subscriber = subscriber;
  12. this.closed = false;
  13. }
  14. unsubscribe() {
  15. if (this.closed) {
  16. return;
  17. }
  18. this.closed = true;
  19. const subject = this.subject;
  20. const observers = subject.observers;
  21. this.subject = null;
  22. if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
  23. return;
  24. }
  25. const subscriberIndex = observers.indexOf(this.subscriber);
  26. if (subscriberIndex !== -1) {
  27. observers.splice(subscriberIndex, 1);
  28. }
  29. }
  30. }
  31. //# sourceMappingURL=SubjectSubscription.js.map