How do I make an "async/await" operator for Jint?
See original GitHub issueI 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 that
var async_example = async(function()
{
return 2;
})
var t = async_example();
console.log(await(t))
// 2
But I would like it that way:
var async_example = async function()
{
return 2;
}
var t = async_example();
console.log(await t)
// 2
I wanted to add the “async / await” operator to Jint. Please help me.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Await operator can only be used within an Async method
1 Answer 1 ... You can only use await in an async method, and Main cannot be async . You'll have to use...
Read more >Async programming
The error message is The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier...
Read more >Async/Await Function in JavaScript
Await : Await function is used to wait for the promise. It could be used within the async block only. It makes the...
Read more >Async/Await, Combine, Closures: A Guide to Modern ...
A comparison between async/await, Combine, and closures in Swift. Includes an overview of the strengths and weaknesses of the different ...
Read more >Asynchronous Programming Using Async/Await in C# ...
The return type of an async method is always Task or Task<T> . It's checked by the compiler, so there's not much room...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
async/awaithas been implemented as first class citizen in main branch.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.