The official documentation page on Google Chromium reads, “Adds support for parsing top level await to V8, as well as many tests.This is the final cl in the series to add support for top level await to v8.”
Top-level await support will ease running JS script in V8
As per the latest ECMAScript proposal on top-level await allows the await keyword to be used at the top level of the module goal. Top-level await enables modules to act as big async functions: With top-level await, ECMAScript Modules (ESM) can await resources, causing other modules who import them to wait before they start evaluating their body.
While Top-level await function lets developers rely on the module system itself to handle all of these, and make sure that things are well-coordinated.
Community is really happy to know that top-level support has been added to V8. On Hacker News, one of the users commented, “This is huge! Finally no more need to use IIFE’s for top level awaits”.
Another user commented, “Top level await does more than remove a main function. If you import modules that use top level await, they will be resolved before the imports finish.
To me this is most important in node where it’s not uncommon to do async operations during initialization. Currently you either have to export a promise or an async function.”
To know more about this read the official Google Chromium documentation page.
Other interesting news in web development