Amp\Promise\wait

function wait(Amp\Promise|React\Promise\PromiseInterface $promise): mixed

Runs the event loop until the promise is resolved. Should not be called within a running event loop.

Use this function only in synchronous contexts to wait for an asynchronous operation. Use coroutines and yield to await promise resolution in a fully asynchronous application instead.

Type Parameter Description Default Value
Amp\Promise|React\Promise\PromiseInterface $promise Promise to wait for. none