liveBook · Manning

Resolved state

As explained in Secrets of the JavaScript Ninja, Third Edition

A settled promise is a promise in either the fulfilled or rejected state whose state and associated value cannot change.

A promise is settled when it is fulfilled or rejected. Its state and associated value are then permanent; while pending, it has not yet settled. section 8.1.1

Figure 8.1 The possible states of a promise: pending, fulfilled, rejected. The value associated with the rejected state is often called a reason.

The diagram shows the three possible promise states and the settled outcomes. section 8.1.1

Resolving with another promise

Resolving a new promise with an already fulfilled promise leads to fulfillment; resolving with a rejected promise leads to rejection. section 8.1.1

How Secrets of the JavaScript Ninja, Third Edition covers it

How deep it goes
Defines settled states and permanence, and outlines how resolve, reject, and executor errors change promise state.
Examples
Uses a state diagram and examples that resolve promises with fulfilled or rejected promises.
What you can do after
Understand when a promise is settled and why its state and value cannot subsequently change.
How it connects
Connects promise settlement to pending, fulfilled, rejected, and thenable states.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secrets of the JavaScript Ninja, Third Edition. The section links point to the parts of the book it draws on.