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

TOP OF THREAD FULL DISCUSSION
re: May I ask a question, how do I fire a event?
 

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



code of conduct - report abuse