DEV Community

loading...

Discussion on: Using Events In Node.js The Right Way

Collapse
usamaashraf profile image
Usama Ashraf Author

Hey chenge, firing is just another word for "emitting".

Collapse
chenge profile image
chenge

Hi Usama thanks. But sendEmailOnRegistration doesn't work, why?

user = {};
myEmitter.emit('user-registered', user);

myEmitter.on('user-registered', (user) => {
  console.log("listened...");
});

myEmitter.on('user-registered', sendEmailOnRegistration);



Thread Thread
chenge profile image
chenge

I see. I must subscribe first.