-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Use async/await instead of promises for wasm loading. NFC #23068
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
Conversation
This change builds upon #23066 |
38970d6
to
0c80cd1
Compare
view with ignore whitespace |
c00d46a
to
e763c3d
Compare
Convert asyncLoad from promises to async/await. This lays the groundwork for more a larger usage in emscripten-core#23068
Convert asyncLoad from promises to async/await. This lays the groundwork for more a larger usage in emscripten-core#23068
Convert asyncLoad from promises to async/await. This lays the groundwork for more a larger usage in #23068
A few minor cleanups here. I finally rememberd to use a followup commit instead of squashing, sorry I didn't do that earlier. I'm pretty happy with this PR now, I think its fairly straight forward. |
// (We must clone the response now in order to use it later, as if we | ||
// try to clone it asynchronously lower down then we will get a | ||
// "response was already consumed" error.) | ||
var clonedResponse = (await response).clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it perhaps more idiomatic to have the await
on line 837? (var x = await fetch(..)
) like line 779 etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could but then we would have an extra await there in the non USE_OFFSET_CONVERTER
path. For the normal path the response can be passed as a Promise of a Response (i.e. we don't need to await it it in the normal path).
…#23104) Convert asyncLoad from promises to async/await. This lays the groundwork for more a larger usage in emscripten-core#23068
…-core#23068) These get lowered away by babel when targetting older engines. Followup to emscripten-core#23066, with code size savings.
These get lowered away by babel when targetting older engines.
Followup to #23066, with code size savings.