What is event-driven programming?

Vasu Vanka
1 min readMay 24, 2020

--

Event-driven programming is building our application based on and respond to events. When an event occurs, like click or keypress, we are running a callback function which is registered to the element for that event.

Event driven programming follows mainly a publish-subscribe pattern.

How to send an event?

event.send(“user.add”,{ name: “vasu”, mobile:9876543210})

How to receive an event?

event.on(“user.add”, (user)=>{
console.log(user) // user info will be logged
})

This is how event driven programming works.

--

--

Vasu Vanka
Vasu Vanka

No responses yet