Replies: 1 comment 4 replies
-
You could check if task wrapping would help here: jint/Jint.Tests/Runtime/AsyncTests.cs Line 38 in 8750190 |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If I call an async function without
await
, I am used to immediately getting a promise back as illustrated when I callf()
with the following JavaScript on playcode.However, when I call
Engine.evaluate(f())
, it doesn't return the promise until it has been resolved many seconds laterIs there any way I can call
f()
in Jint and immediately get the promise back? My program is single threaded, and I can't block.As more context, my actual use case uses
ManualPromise
rather thanTask.Delay
, in which case I can make analogous examples work withthen()
but notawait
, because the call toengine.Evaluate()
never returns, so I can't resolve the promise in my thread. I did look at some of the discussions of this, but wasn't able to figure out how to reproduce the behavior of immediately evaluating anasync
function to a pending promise. I apologize if that was covered and I missed it.Thanks, Mike
Beta Was this translation helpful? Give feedback.
All reactions