4 ms·
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 loadin
by jondubois 10y ago
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.
- bmeck 10y agoincorrect. `await` is a reserved word only in async contexts, the UI thread event loop still runs while `await`ing.
- egeozcan 10y agoIf 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.
- BinaryIdiot 10y agoIn that script, yes. But in JavaScript you can have multiple scripts :)