Event-driven development and the event loop

Event-driven development came from event-driven programming, in other words, outside the paradigm of object-oriented programming, event-based programming is the ability to treat the application flow after an event is fired.

JavaScript is a great language for event-driven programming; it allows anonymous functions and closures, and more importantly, the syntax is very familiar with other programming languages. The callback functions that are called when an event occurs can be written in the same place where you capture the event. Therefore, it is easy to code and easy to maintain your application.

Almost everything in Node uses callbacks. Node callbacks are functions that will be implemented in the asynchronous ...

Get Learning Single-page Web Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.