Skip to main content
11 events
when toggle format what by license comment
Jun 6 at 20:40 vote accept dx_over_dt
Dec 1, 2019 at 21:08 comment added jfriend00 It doesn't need to transform it into regular .then() code because it can directly suspend function execution. How exactly a given engine does this is implementation dependent. It's certainly cleaner if they natively support suspending function execution upon an await without rewriting the logic.
Dec 1, 2019 at 21:00 comment added dx_over_dt Ah, so it doesn't first transform the code into a Promise and then run that.
Dec 1, 2019 at 20:58 comment added jfriend00 Well, the engine has await functionality built in. It literally suspends execution of the function body until the promise resolves/rejects. It doesn't have to rewrite code into .then() handlers.
Dec 1, 2019 at 20:54 comment added dx_over_dt Right, which is why I'm wondering how the engine handles them.
Dec 1, 2019 at 20:53 comment added jfriend00 @dx_over_dt - Conditional asynchronous operations are simply a lot easier to code with async/await.
Dec 1, 2019 at 20:51 comment added dx_over_dt So if there were a lot of conditional awaits, it would produce a bunch of stringed, repeated, thens?
Dec 1, 2019 at 20:50 comment added jfriend00 @dx_over_dt - OK, I fixed that.
Dec 1, 2019 at 20:50 history edited jfriend00 CC BY-SA 4.0
added 44 characters in body
Dec 1, 2019 at 20:47 comment added dx_over_dt When doAwait is true, I don't return the value of doSomethingAsync.
Dec 1, 2019 at 20:46 history answered jfriend00 CC BY-SA 4.0