emscripten-core / emscripten-core/emscripten
Async-Await syntax on Asyncify causes "Unexpected token"
Open
asyncify
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
I can use traditional call back style code with Asyncify but when I want to use async-await, the code doesn't compile well.
```
EM_JS(const char*, fetchSmth, (), {
return Asyncify.handleAsync(async()=>{
var response = await fetch("http://whatever.site.goes.here/");
var moduleFile = await response.text();
var lengthBytes = lengthBytesUTF8(moduleFile) + 1;
var result = _malloc(lengthBytes);
stringToUTF8(stringified, result, lengthBytes);
return result;
});
});
```
Contributor guide
Assessment
This issue has not been assessed yet.