DEV Community

Cover image for Day 9 – Mastering EventEmitter - Learning Node JS In 30 Days [Mini series]
Muhammad Ali (Nerdjfpb)
Muhammad Ali (Nerdjfpb)

Posted on • Originally published at blog.nerdjfpb.com

Day 9 – Mastering EventEmitter - Learning Node JS In 30 Days [Mini series]

Today we’re going to learn about EventEmitter

Events (Core module of node js)

Alt Text

First we need to require the events

Alt Text

Now we can do something for clicking any element.

Alt Text

This event module will help us to use click and different events. We can now create custom events also!

For using the custom event first we'll const myEmitter = new events() and get new events on myEmitter -

Alt Text

Second step is making a new custom event which is called customEvent in this occasion

Alt Text

Then finally we need make this event happens using myEmitter.emit

Alt Text

Final Result

Alt Text

So do you understand a bit of EventEmitter right now ?

You can see the graphical version here

Originally it published on nerdjfpbblog. You can connect with me in twitter or linkedin !

You can read the old posts from here --

Top comments (0)