API Reference
One-shot eventual value: Pending (0), Fulfilled (1), Rejected (2).
Combinators attach continuations; wait() parks the OS thread until
settlement. The first settlement wins and later calls are ignored. A
rejection carries a String reason.
Every combinator hands back a new promise and leaves this one as it is, so a chain of them settles independently at each link. Handlers added after settlement run at once on the calling thread.
init(state: Int, value: T, reason: String, syncId: Int)
fields
- _handlers: Array<fn(T): Void>
- _reason: String
- _rejectHandlers: Array<fn(String): Void>
- _state: Int
- _syncId: Int
- _value: T
Settlement record for Promise.allSettled. One per input promise,
in input order: status is "fulfilled" or "rejected", value
holds the payload of a fulfillment, and reason the message of a
rejection.
init(status: String, value: T, reason: String)
fields
- reason: String
- status: String
- value: T
Manual settlement handles from Promise.withResolvers. It holds the
pending promise plus the two calls that settle it, which is how a
worker thread, an OS callback, or an I/O handler hands a value back
into the promise chain.
init(promise: Promise<T>)
fields
- promise: Promise<T>