await on synchronous functions
Mark S. Miller
erights at google.com
Sun Jul 19 17:23:21 UTC 2015
On Sun, Jul 19, 2015 at 10:16 AM, Bergi <a.d.bergi at web.de> wrote:
> Mark S. Miller wrote:
> We've talked about allowing await at the top level of modules, I think so
>> that the await continuation could proceed after the synchronous part of
>> load. I am unclear on the details and cannot reconstruct a sensible story
>> from memory.
> I'd love to see that, using `await` in my main.js (or app.js or whatever
> it is called), so that I can write scripts using asynchronous functions
> without having to wrap everything in an IEAFE (immediately-executed
> asynchronous function expression).
Cute. How do you pronounce it?
> Not sure whether such syntax might also be used with asynchronous module
> loaders, but at least at the top level of an app this would certainly be
> While `JSON.parse(await fs.readFile("options.json"))` could trivially be
> replaced with `fs.readFileSync`, such might not be the case for `await
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss