-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[file_packager] Convert fetchRemotePackage to async. NFC #24893
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
base: main
Are you sure you want to change the base?
Conversation
e5efcc8
to
13305e0
Compare
13305e0
to
f874811
Compare
Part 4 in the sequence following emscripten-core#24882, emscripten-core#24883 and emscripten-core#24885.
const iterate = () => reader.read().then(handleChunk).catch((cause) => { | ||
return Promise.reject(new Error(`Unexpected error while handling : ${response.url} ${cause}`, {cause})); | ||
}); | ||
const chunks = []; |
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.
Anything here and on can be removed nowadays - all browsers we care about support response.arrayBuffer()
so it's enough to return just that.
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.
Ah, or is the goal to show actual progress? Then perhaps the opposite, remove the polyfill.
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.
yes, the goal is to show progress.
I don't know which polyfill is being referred to above, but its not something emscripten includes.
Maybe it can be remove now? It was added in #22016 but I don't see anything about if/when the polyfill might be used. Probably best to leave that to a separate cleanup PR.
f874811
to
6d48d48
Compare
while (1) { | ||
var {done, value} = await reader.read(); | ||
if (done) break; |
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 can also do
while (1) { | |
var {done, value} = await reader.read(); | |
if (done) break; | |
for await (var value of reader) { |
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.
That is a very new JS feature though right? I'll maybe leave that as a followup since its not a feature we currently depend onn
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.
Hm relatively new, yeah.
Part 4 in the sequence following #24882, #24883 and #24885.