nest-emitter icon indicating copy to clipboard operation
nest-emitter copied to clipboard

For the .on, do we need to specify that it's async?

Open shamoons opened this issue 4 years ago • 2 comments

    this.emitter.on('notification', async msg => await this.onNotification(msg));

Can I just do:

    this.emitter.on('notification', this.onNotification);

I'm not sure what benefit the async offers?

shamoons avatar May 28 '20 17:05 shamoons

+1. Also, does this library support await for event handlers? As I understand, for now it just causes promise loose.

DenKorn avatar Oct 19 '20 22:10 DenKorn

Also, why should it be defined inside onModuleInit and not just inside the constructor?

reinoute avatar May 11 '21 16:05 reinoute