-
-
Notifications
You must be signed in to change notification settings - Fork 564
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
How do I make an "async/await" operator for Jint? #755
Comments
Promises have yet to have been implemented. (So no async/await yet) |
You might want to follow the building block PR, Promises. |
I have created a partial, blocking and simple await support for C# Tasks and ValueTask. @sebastienros Would it be fine if you add this partial support until proper await implementation done? |
Closing this as duplicate of #514 , we have the promises, but async/await needs to be done. I think generators need to be done as it has some building blocks once again. |
|
Hi @lahma , does this also mean one could set an C# function that returns a Task that can be awaited in JS? For example: engine.SetValue("testAsync", (Func<Task<object?>>)(async () => await Task.FromResult(new { foo = "bar" }))); I tried this with the following JS: const bar = await testAsync(); Which throws a |
Sorry I've been a bit absent as my wife passed away a month ago and I had to prioritize things a bit. I think there's a PR #1567 that tries to fill the gap between .NET Task and JS's async, but there might be dragons. If you get |
Sorry for your loss Marko. I noticed you have merged that PR, which is fantastic - thank you! I'll go take a look. |
I never reported back, but I wanted to let you know that the bridging from Promise to Task and the async/await keywords work super amazing 😍 |
I made a function in C# for Promise, Async and Await, but I don't want it to be "async / await" functions in javascript, but an operator.
It works in my custom
Jint.Engine
like thatBut I would like it that way:
I wanted to add the "async / await" operator to Jint. Please help me.
The text was updated successfully, but these errors were encountered: