(no description)
File Size: | 97 lines (3 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Interface: PromiseInterface - X-Ref
A promise represents the eventual result of an asynchronous operation.then(callable $onFulfilled = null,callable $onRejected = null) X-Ref |
Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler. param: callable $onFulfilled Invoked when the promise fulfills. param: callable $onRejected Invoked when the promise is rejected. return: PromiseInterface |
otherwise(callable $onRejected) X-Ref |
Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled. param: callable $onRejected Invoked when the promise is rejected. return: PromiseInterface |
getState() X-Ref |
Get the state of the promise ("pending", "rejected", or "fulfilled"). The three states can be checked against the constants defined on PromiseInterface: PENDING, FULFILLED, and REJECTED. return: string |
resolve($value) X-Ref |
Resolve the promise with the given value. param: mixed $value |
reject($reason) X-Ref |
Reject the promise with the given reason. param: mixed $reason |
cancel() X-Ref |
Cancels the promise if possible. |
wait($unwrap = true) X-Ref |
Waits until the promise completes if possible. Pass $unwrap as true to unwrap the result of the promise, either returning the resolved value or throwing the rejected exception. If the promise cannot be waited on, then the promise will be rejected. param: bool $unwrap return: mixed |