Events (Core module of node js) – https://nodejs.org/api/events.html

First we need to require the events

Now we can do something for clicking any element.

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

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

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

Final Result

So do you understand a bit of EventEmitter right now ?

Leave a Reply

Your email address will not be published. Required fields are marked *