Hacker News new | ask | show | jobs
by bmeck 3568 days ago
incorrect. `await` is a reserved word only in async contexts, the UI thread event loop still runs while `await`ing.
1 comments

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.
In that script, yes. But in JavaScript you can have multiple scripts :)
> in JavaScript you can have multiple scripts

You mean, you can embed multiple script elements in HTML? Yes. But allowing global await in ES spec means also enabling it in node.

or you could just do `import('a'); import('b');` to load `a` and `b` in parallel