Async Patterns & Control Flow

Every topic in this chapter, free to read online. Work through them in order, or jump straight to the runtime detail you need.

Start with the first topic7.1 Error-First Callbacks
07chapter
6topics
Freeonline

Topics

6 topics

Error-First Callbacks

How Node.js error-first callbacks work, why the first argument carries errors, and how callback dispatch connects native async work back to JavaScript.

Promise Microtasks

How Node.js orders Promise jobs, process.nextTick callbacks, queueMicrotask work, timers, and I/O across CommonJS, ES modules, and active microtask drains.

Async/Await

How async functions and await work in Node.js through promise wrapping, suspension, resumption, microtasks, errors, and V8 state machines.

EventEmitter Internals

How EventEmitter stores listeners, dispatches emit synchronously, handles error events, preserves listener order, and reports possible leaks.

Async Iterators

How async iterators work in Node.js through Symbol.asyncIterator, for await...of, async generators, stream consumption, and backpressure.

Promise Combinators

How Promise.all, allSettled, race, and any behave in Node.js, including short-circuiting, failure propagation, cancellation gaps, and concurrency limits.