Promise and await problem
it seems there are some issues in Promise and Await synax: eg:jsContext.executeVoidScript("console.log("Hello World");\n" + "function testAsync(params) {\n" + " console.log("test Async start");\n" + " return new Promise(function (resolve, reject) {\n" + " resolve("done");\n" + " });\n" + "}\n" + "\n" + "async function main(){\n" + " var t = await testAsync(11);\n" + " console.log("test finish"+t);\n" + "}\n" + "main();",null); The log in console only shows Hello world and test Async start And the "test finish" has been gone and it seems it has been blocked at the line " var t = await testAsync(11);\n" +"
You need to run the tasks on the job queue. See:
JS_EnqueueJob(), JS_IsJobPending(),
JS_ExecutePendingJob()