Skip to content

Only use Fetch API in browser #5596

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

Merged
merged 1 commit into from
Sep 20, 2017
Merged

Only use Fetch API in browser #5596

merged 1 commit into from
Sep 20, 2017

Conversation

nazar-pc
Copy link
Contributor

fetch() can be present in some environments like Electron's renderer process, but is not useful outside browser environment

This is an alternative, simpler approach to #5577

src/preamble.js Outdated
// if we don't have the binary yet, and have the Fetch api, use that
if (!Module['wasmBinary'] && typeof fetch === 'function') {
// if we don't have the binary yet, and have the Fetch api, use that, but only when in browser environment
if (!Module['wasmBinary'] && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === 'function') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall this looks reasonable to me, thanks. please just add to the comment something like in some other environments, like Electron, fetch may exist but behave differently than on the Web, so avoid it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrased, is it better now?

…r process, but is not useful outside browser environment
@kripken kripken merged commit b1f07c5 into emscripten-core:incoming Sep 20, 2017
@kripken
Copy link
Member

kripken commented Sep 20, 2017

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants