Use async/await instead of promises for wasm loading. NFC#23068
Merged
Conversation
Collaborator
Author
|
This change builds upon #23066 |
38970d6 to
0c80cd1
Compare
Collaborator
Author
|
view with ignore whitespace |
brendandahl
reviewed
Dec 5, 2024
c00d46a to
e763c3d
Compare
sbc100
added a commit
to sbc100/emscripten
that referenced
this pull request
Dec 8, 2024
Convert asyncLoad from promises to async/await. This lays the groundwork for more a larger usage in emscripten-core#23068
sbc100
added a commit
to sbc100/emscripten
that referenced
this pull request
Dec 9, 2024
Convert asyncLoad from promises to async/await. This lays the groundwork for more a larger usage in emscripten-core#23068
kripken
reviewed
Dec 9, 2024
kripken
reviewed
Dec 9, 2024
sbc100
added a commit
that referenced
this pull request
Dec 9, 2024
Convert asyncLoad from promises to async/await. This lays the groundwork for more a larger usage in #23068
brendandahl
reviewed
Dec 9, 2024
Collaborator
Author
|
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. |
kripken
approved these changes
Dec 10, 2024
| // (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(); |
Member
There was a problem hiding this comment.
Is it perhaps more idiomatic to have the await on line 837? (var x = await fetch(..)) like line 779 etc.
Collaborator
Author
There was a problem hiding this comment.
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).
brendandahl
approved these changes
Dec 10, 2024
hedwigz
pushed a commit
to hedwigz/emscripten
that referenced
this pull request
Dec 18, 2024
…#23104) Convert asyncLoad from promises to async/await. This lays the groundwork for more a larger usage in emscripten-core#23068
hedwigz
pushed a commit
to hedwigz/emscripten
that referenced
this pull request
Dec 18, 2024
…-core#23068) These get lowered away by babel when targetting older engines. Followup to emscripten-core#23066, with code size savings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These get lowered away by babel when targetting older engines.
Followup to #23066, with code size savings.