4 ms·
async/await is just sugar around promises. when you await something, that something must be a promise. coroutines are used to make your code appear to execute
by mkoryak 10y ago
async/await is just sugar around promises.
when you await something, that something must be a promise.
coroutines are used to make your code appear to execute without a need for a callback, and in order to create a coroutine one must wrap the function doing the awaiting in a generator.
now, I am assuming (perhaps incorrectly) that the async keyoword marks the function for wrapping, and await lets you know where the yields should go. or something like that :)
of course, now thats its all native, I have no idea any more