So im basically trying to emit and listen to a specific event on different typescript classes. The first event that is emitted is being listened properly on the other class but once I set a timeout to emit other event after 10 seconds for example, its like the listener is not listening anymore..

**commonEmitter.ts**

```
let events = require('events');
let em = new events.EventEmitter();
module.exports.commonEmitter = em;

```

**network.ts**

```
export class Network {

  constructor() {
    this.setConnection('connected');

    setTimeout(() => {
      commonEmitter.emit('connectionStatusChanged');
      connection = 'disconnected';
    }, 10000);
  }

private setConnection(newConnection): void {
      connection = newConnection
      commonEmitter.emit('connectionStatusChanged');
}

public isConnected(): boolean {
    return connection === 'connected';
}

}

export let connection = null;

```

**view.ts**

```
export class View {

private network: any;

constructor() { }

private test(){
   console.log('Online? ' + this.network.isConnected());
}

public init(){

commonEmitter.on('connectionStatusChanged', this.test());

this.network = new Network();

}

```

At the end, both of the events are emitted but only the first one is being "listened".
Whats the reason for that and how I can do it in an ordered way?