lively4-core
lively4-core copied to clipboard
Allow await on top level in Workspace
Currently, we cannot use await
to wait for Promises in Workspaces (e.g. when fetch
ing 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
- the function should return a
- take care of top-level variables, that still need to be recorded
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()
})()