Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise Listener不执行 #305

Open
sniper-xx opened this issue Mar 3, 2024 · 1 comment
Open

Promise Listener不执行 #305

sniper-xx opened this issue Mar 3, 2024 · 1 comment

Comments

@sniper-xx
Copy link

sniper-xx commented Mar 3, 2024

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 不执行。

@caoccao
Copy link
Owner

caoccao commented Mar 4, 2024

There is a test case for this feature. As I just tested, it works as expected. Could you try that case out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants