Skip to content
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

Possibility for a 'self' polyfill #252

Closed
billinghamj opened this issue Jan 5, 2016 · 2 comments · Fixed by #253
Closed

Possibility for a 'self' polyfill #252

billinghamj opened this issue Jan 5, 2016 · 2 comments · Fixed by #253

Comments

@billinghamj
Copy link
Contributor

In non-browser execution environments, self typically doesn't exist. It seems to me that to avoid errors while loading the script, it'd be nice if fetch would failover to use an equivalent global instead - only if self isn't available.

An additional benefit is that this would improve support for very old browsers which don't have self (which was added in HTML5).

The purpose of this change is not to provide support for non-browser environments, but to avoid crashing those environments when the script is included. This happens, for example, when including isomorphic-fetch in React Native due to the way it packages the node modules.

Would you be open to considering a PR which implements this?

@dgraham
Copy link
Contributor

dgraham commented Jan 5, 2016

Because this library is designed for, and tested in, browser environments, we don't have a way to ensure future changes won't break compatibility with React Native. The discussion in #125 might lead to a workaround.

@dgraham dgraham closed this as completed Jan 5, 2016
@billinghamj
Copy link
Contributor Author

Unfortunately, it doesn't. As react native packages all the JS files together, and fetch doesn't support modularization, it runs regardless of whether it is required or not.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants