The state of a promise.
A promise goes through a very simple life cycle. It starts with PENDING, during which it either runs a business function, or waits to be settled by a handle. The promise eventually gets settled in either of two possible states. If the function runs to end successfully, or the handle calls resolve, the promise is resolved; if the function throws an exception, or the handle calls reject, the promise ends up rejected.
Type | Name | Value |
---|---|---|
constant | PENDING | 0 |
constant | RESOLVED | 1 |
constant | REJECTED | 2 |
public const PromiseState PENDING = 0
The promise is pending to settle.
public const PromiseState RESOLVED = 1
The promise is resolved. A result can be returned now immediately.
public const PromiseState REJECTED = 2
The promise is rejected. An exception can be returned now immediately.