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

Policy for adding browser globals? #151

Closed
cesarandreu opened this issue Jun 8, 2015 · 6 comments

Comments

@cesarandreu
Copy link
Contributor

commented Jun 8, 2015

What are your plans for handling new browser globals? Or rather, how far along does adoption have to be for a browser global to get added?

For example, Fetch API adds window.fetch, window.Request, window.Response, and window.Headers.

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Jun 8, 2015

The browser globals are defined here. I'm not sure if there's a policy, but only a minimum amount of globals are exposed. I wouldn't expect window.fetch to be called as fetch.

@cesarandreu

This comment has been minimized.

Copy link
Contributor Author

commented Jun 9, 2015

Gotcha. I hadn't noticed, but yeah, none of the other browser globals are set.

@dcousens

This comment has been minimized.

Copy link
Member

commented Jun 9, 2015

@cesarandreu AFAIK the policy is you should be using window.fetch, not just fetch.
If you feel strongly against this, you could always add /* global fetch */ at the top of your file.

@feross

This comment has been minimized.

Copy link
Member

commented Jun 11, 2015

Yep, what @dcousens said. Especially for lowercase global variables like fetch, it's really not clear where they come from (local or global variable?) unless you prefix with window. window.fetch is clearest.

I've considered adding all the browser globals that begin with capital letters, but it hasn't been annoying enough for me yet (or seemingly anyone else). I just do /* global Blob */ if I'm going to be using lots of Blobs in a certain file.

@cesarandreu

This comment has been minimized.

Copy link
Contributor Author

commented Jun 11, 2015

I gave it some thought, I agree it's probably better since it's more explicit.

@feross

This comment has been minimized.

Copy link
Member

commented Jun 11, 2015

Cool, I'm going to close this.

@feross feross closed this Jun 11, 2015

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants
You can’t perform that action at this time.