Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow await on top level in Workspace #97

Open
onsetsu opened this issue May 3, 2017 · 1 comment
Open

Allow await on top level in Workspace #97

onsetsu opened this issue May 3, 2017 · 1 comment

Comments

@onsetsu
Copy link
Contributor

onsetsu commented May 3, 2017

Currently, we cannot use await to wait for Promises in Workspaces (e.g. when fetching a resource).

To fix this: Update source code transformation to allow for top-level await statements.

When alternating the source code transformation, we have to consider the following:

  • Arrange the order to move imports to the top of the file.
  • Enclose all other statements in an asyncronous iife.
    • the function should return a do-expression over all moved statements to provide the last evaluated statement as result
  • take care of top-level variables, that still need to be recorded
@JensLincke
Copy link
Contributor

BUMP BUMP BUMP @onsetsu BUMP BUMP BUMP
I want this feature, I have to type the following code over and over and over

var value;
(async () => {
  value = await somthin()
})()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants