Async-await does not make it sync. It only gives the "illusion" of synchronous execution.
For example Typescript has / had a state machine that supports async/await without browser support. It's a state machine that gives an illusion of sync execution while the code actually executes async + on one thread. Now async is supported by most browsers, but I thought it's worth mentioning. So it's not block-the-browser sync & works (and did work) without browser support.
For example unless you await some async function, it won't wait for you. This confuses developers often, at least confused some guys at work. Also, same effect as a trap: try-catch won't catch your async exception, if you don't await the async call. Confused guys at work...
Check out this plunk for an example. Try to guess what happens without looking at the console :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Async-await does not make it sync. It only gives the "illusion" of synchronous execution.
For example Typescript has / had a state machine that supports async/await without browser support. It's a state machine that gives an illusion of sync execution while the code actually executes async + on one thread. Now async is supported by most browsers, but I thought it's worth mentioning. So it's not block-the-browser sync & works (and did work) without browser support.
For example unless you
await
some async function, it won't wait for you. This confuses developers often, at least confused some guys at work. Also, same effect as a trap: try-catch won't catch your async exception, if you don't await the async call. Confused guys at work...Check out this plunk for an example. Try to guess what happens without looking at the console :)