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
Promises don't work #25
Comments
I also tried:
None of these approaches worked. They kept the same behavior, the execution stucked before "after promise" was printed. |
It does work if I force the use of JavascriptCore, which is weird, because the documentation of QuickJS states that it does support promises and its online demo works fine when I test the async code there. |
Hi @Tiagoperes. I will check |
me too |
@Tiagoperes you should call executePendingJob |
@PhungVanHoa this wouldn't be viable in realistic scenarios. The example I gave is short and its only purpose is to demonstrate the problem. My real issue comes from the need to use a library that, internally relies in many promises. I have no control over these promises and I dont know when they're created. I shouldn't have to explicitly resolve them. Today, if you use the default implementation of flutter_js, the program hangs everytime a promise is created internally by the js lib, and, as I said, I have no way of knowing when a promise is created, I only have access to the API. This is not problem for me anymore since I realized I could force JavascriptCore on Android and things would work as expected. But, in any case, I think it should also work with QuickJS. |
I released some improvements in QuickJS integration and it should work better now. There is not i could do better to help you with it. |
version: 0.2.2+0
the following code never prints "after promise":
In the flutter code, I call
widget.jsRuntime.enableHandlePromises()
andwidget.jsRuntime.evaluate("start()");
."before promise" is successfuly printed, but the execution hangs in the promise, even if it's already fulfilled. "after promise" is never printed.
Tested in Android
The text was updated successfully, but these errors were encountered: