Re:Top-level await in JavaScript is a footgun
by jondubois on Wednesday September 14, 2016 @01:42PM
(#12499406)
Yes, top-level await sounds silly. It would freeze the entire app... You couldn't even render a loading progress bar - It would defeat the whole point of loading modules asynchronously.
[ Parent
| on HN ]
Re:Top-level await in JavaScript is a footgun
by bmeck on Wednesday September 14, 2016 @01:43PM
(#12499417)
incorrect. `await` is a reserved word only in async contexts, the UI thread event loop still runs while `await`ing.
Re:Top-level await in JavaScript is a footgun
by egeozcan on Wednesday September 14, 2016 @02:17PM
(#12499755)
If you run an await as a first thing in the top-level, you have nothing in the event loop to run. Await blocks everything after itself, and that is very dangerous if done on the top-level.
Re:Top-level await in JavaScript is a footgun
by BinaryIdiot on Wednesday September 14, 2016 @03:11PM
(#12500271)
In that script, yes. But in JavaScript you can have multiple scripts :)