re: Using Events In Node.js The Right Way VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION

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

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);



I see. I must subscribe first.

code of conduct - report abuse