Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / SubjectSubscription.js
1 import { Subscription } from './Subscription';
2 export class SubjectSubscription extends Subscription {
3     constructor(subject, subscriber) {
4         super();
5         this.subject = subject;
6         this.subscriber = subscriber;
7         this.closed = false;
8     }
9     unsubscribe() {
10         if (this.closed) {
11             return;
12         }
13         this.closed = true;
14         const subject = this.subject;
15         const observers = subject.observers;
16         this.subject = null;
17         if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
18             return;
19         }
20         const subscriberIndex = observers.indexOf(this.subscriber);
21         if (subscriberIndex !== -1) {
22             observers.splice(subscriberIndex, 1);
23         }
24     }
25 }
26 //# sourceMappingURL=SubjectSubscription.js.map