phpv8/v8js

Nothing print on Promise in js

websharik opened this issue · 0 comments

$v8 = new V8Js();
$js = <<<JS
    //const wait = (delay) => new Promise(resolve => setTimeout(resolve, delay))
    (async () => {
        //await wait(100)
        print('Hello world!')
    })()
JS;

try {
    $v8->executeString($js);
} catch (V8JsScriptException $e) {
    var_dump($e);
}

Print: Hello world

$v8 = new V8Js();
$js = <<<JS
    const wait = (delay) => new Promise(resolve => setTimeout(resolve, delay))
    (async () => {
        //await wait(100)
        print('Hello world!')
    })()
JS;

try {
    $v8->executeString($js);
} catch (V8JsScriptException $e) {
    var_dump($e);
}

Nothing print.