Promise Listener不执行
Opened this issue · 1 comments
sniper-xx commented
JS代码:
function a(){
return new Promise((resolve, reject) => { resolve(1234); })
}
globalThis.main=a;
Java代码:
runtime.getExecutor(code).executeVoid();
var obj = runtime.getGlobalObject().invoke("main");
var callback = new AsyncHandler();
try (V8ValuePromise promise = (V8ValuePromise) obj) {
promise.register(callback);
runtime.await();
// The callback happens.
log("============>>>{}, {}", callback.getResult(), promise.getResult());
} finally {
runtime.lowMemoryNotification();
}
问题:
callback 不执行。