A promise represents the eventual result of an asynchronous operation.
The primary way of interacting with a promise is through its then method, which registers callbacks to receive either a promise’s eventual value or the reason why the promise cannot be fulfilled.
Methods | ||
---|---|---|
public
|
then(callable $onFulfilled = null, callable $onRejected = null): PromiseInterface
|
# |
public
|
otherwise(callable $onRejected): PromiseInterface
|
# |
public
|
getState(): string
|
# |
public
|
resolve(mixed $value): void
|
# |
public
|
reject(mixed $reason): void
|
# |
public
|
cancel(): void
|
# |
public
|
wait(bool $unwrap = true): mixed
|
# |
Constants | ||
---|---|---|
public
|
PENDING = 'pending'
|
# |
public
|
FULFILLED = 'fulfilled'
|
# |
public
|
REJECTED = 'rejected'
|
# |