Hour 18. The Events Module

What You’ll Learn in This Hour:

• Using the Events module

• Emitting and listening for events

• How the Events module works with network programming

• Adding and removing events dynamically

Understanding Events

As you have learned, Node.js is opinionated about the best way to approach concurrency. It suggests that using an event loop (sometimes referred to as an event queue) is an efficient way to support asynchronous code and address the issue of concurrency. For developers coming from procedural, imperative languages this can be a paradigm shift, and many developers refer to programming around events as “programming inside out.”

The Events module is central to Node.js, and many other modules use it to structure ...

Get Sams Teach Yourself Node.js in 24 Hours 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.