|
@v8js | |||||
|
🚀 Top-level await makes it possible to use the `await` keyword outside of async functions in JavaScript modules!
@mylesborins explains: v8.dev/features/top-l… pic.twitter.com/kB7u7ZFGiq
|
||||||
|
||||||
|
Jonas Jonas
@joshmallox
|
8. lis |
|
So I'll be able to use it in node if I use the experimental es modules?
|
||
|
|
||
|
sMyle
@MylesBorins
|
8. lis |
|
not yet. This landed in V8 master, so it will be another couple months for that to land in Node
|
||
|
|
||
|
Mehul Mohan
@mehulmpt
|
8. lis |
|
Isn’t that blocking main thread now?
|
||
|
|
||
|
sMyle
@MylesBorins
|
8. lis |
|
Top-Level await won't block the main thread. It will block execution of parents until bindings are exported, but siblings will be able to execute independently.
|
||
|
|
||
|
Adam Argyle
@argyleink
|
8. lis |
|
|
||
|
Ingvar Stepanyan
@RReverser
|
8. lis |
|
To be completely fair, the first example would need to show how to deal with propagating errors, too. It's so cool you don't need to think about that anymore!
|
||
|
|
||
|
Sergey Rubanov
@chicoxyzzy
|
8. lis |
|
AFAIR it's also available in Safari's Inspector REPL
|
||
|
|
||
|
Andy Hayden
@andyhayden1
|
8. lis |
|
what about top level `for await`?
|
||
|
|
||
|
sMyle
@MylesBorins
|
8. lis |
|
|
||
|
Josh Weston
@joshsweston
|
8. lis |
|
Great improvement; I've been anxiously (a)waiting for this one!
|
||
|
|
||