title: How to check if the eventListener is removed?
body: <p>I want to remove event listener upon unsubscribing to the observable. My question is how do i check if whether the event listener is removed or not. Is there any way to check if the event listener is remove?</p>
  
  <pre><code>export class BroadcastService {
  
    public events: Observable &lt; any &gt; ;
    public channel = new BroadcastChannel('test_channel');
  
    constructor() {
      this.events = Observable.create((observer) =&gt; {
  
        const listener = (ev) =&gt; {
          observer.next(ev.data),
            console.log("on")
        };
        this.channel.addEventListener('message', listener);
  
        return () =&gt; {
          this.channel.removeEventListener('message', listener);
        };
      });
    }
  
    public addPerson(person: any) {
      this.channel.postMessage(person);
    }
  
  }
  </code></pre>
  
  <p>And my Component:</p>
  
  <pre><code>export class Page2Component implements OnInit {
    private componetDestroyed: Subject &lt; any &gt; = new Subject();
    private xx: any;
  
    public person = {}
    as Person;
  
    constructor(public broadCastService: BroadcastService) {
  
    }
  
    ngOnInit() {
      this.xx = this.broadCastService.events.subscribe((e) =&gt; {
        this.person.age = e.age;
        this.person.name = e.name;
      });
      console.log("onInit");
    }
  
    ngOnDestroy() {
      this.xx.unsubscribe();
      console.log("onDestroy");
    }
  </code></pre>