|
Answer» In general programming terms, event-driven programming is a programming technique in which the flow of the program is determined by EVENTS such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs or THREADS.
As we know, Node.js is a single threaded application but it can support multithreading through Event and callback function. Event Driven programming is running on Request and response technique. We have to define a target which may be any button or click event so whenever our application is going to receive a request on the target our application will ACCEPT and process that request, and provide a response BACK to the user. This is usually achieved through Callback function. You can review the below example for more reference:- function addtoStudent(STUDENTID)
{
event.send("student.add" , {id: studentId})
}
event.on("student.add", function(event)
{
show("Adding New Student" +event.id);
});
|