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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.