-
-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Description
The code works if i do $promise->wait();, however i am not sure how can i call the promise to work async.
foreach ($entries as $key=>$value)
{
$promise = new Promise(function() use (&$promise, $key, $value)
{
// Do some heavy lifting work.
$mainOutput = array($key, $output, $value);
$promise->resolve($mainOutput);
});
$promise->then(
// $onFulfilled
function ($mainOutput)
{
static::addToResponse($mainOutput);
},
// $onRejected
function ($reason)
{
echo 'The promise was rejected.';
}
);
if(static::$sync)
{
$promise->wait();
}
else
{
}
}
Metadata
Metadata
Assignees
Labels
No labels