Amp\LazyPromise class LazyPromise implements Amp\Promise

Creates a promise that calls $promisor only when the result of the promise is requested (i.e. onResolve() is called on the promise). $promisor can return a promise or any value. If $promisor throws an exception, the promise fails with that exception. If $promisor returns a Generator, it will be run as a coroutine.

Summary

Properties

Methods

Properties

Methods

__construct — public function __construct(callable $promisor)
No documentation.
Type Parameter Description Default Value
callable $promisor Function which starts an async operation, returning a Promise (or any value). Generators will be run as a coroutine. none
onResolve — public function onResolve(callable $onResolved)
No documentation.
Type Parameter Description Default Value
callable $onResolved No documentation. none