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

window.fetch method implementation #25

Open
chicoxyzzy opened this issue Jan 27, 2015 · 25 comments
Open

window.fetch method implementation #25

chicoxyzzy opened this issue Jan 27, 2015 · 25 comments

Comments

@chicoxyzzy
Copy link
Contributor

just noticed core-js missing fetch polyfill
subjectively best existing implemetation https://github.com/github/fetch

@zloirock
Copy link
Owner

It's missing because currently core-js adds only cross-platform features, not browser-only or server-only. I will add it if i will add modules for network and DOM.

@chicoxyzzy
Copy link
Contributor Author

this makes sense.
thoughts: environment-specific features can be bundled as optional modules. than one will be able to import browser-shim.js or node-shim.js (or server-shim.js with respect to iojs). or is it sounds as a standalone project I better should start by myself?

@zloirock
Copy link
Owner

I'll think about it.

@zloirock
Copy link
Owner

@chicoxyzzy Think about what else can be added to the client and server shims.

@sebmck sebmck mentioned this issue Mar 15, 2015
@nelix
Copy link

nelix commented Mar 23, 2015

It would be really nice to have core-js shim this function in both node and the browser.
All the current polyfill's either don't browserify nice or don't do commonjs (polluting window.fetch and Promise without permission).

@zloirock
Copy link
Owner

Because of the large number of requests, I reopen it. Maybe I will add it, but it's not priority task.

@nelix
Copy link

nelix commented Mar 24, 2015

I'm not sure what I am getting my self into, but perhaps I could help out with this..? Since I care about it.

@zloirock
Copy link
Owner

Yep, you can add PR with implementation as modules/web.fetch.js. Module should be as compact as possible - library is already too bloated.

@NekR
Copy link

NekR commented Apr 6, 2015

Why you need fetch people? It does not even have abort capabilities for request and will never be able to polyfill network streams such they as they will be present in fetch. All other functional is just wrap XHR with Promise.

@zloirock zloirock mentioned this issue Jul 4, 2015
35 tasks
@mgol
Copy link

mgol commented Aug 24, 2015

I think core-js should continue to provide an ES6 environment, at least by default; fetch is a DOM standard so that would be vastly different. If you start polyfilling the DOM, the library will get much larger.

In any case, GitHub has a fetch polyfill that's fairly popular.

@steida
Copy link

steida commented Sep 20, 2015

Please don't add any DOM related stuff since it would break non DOM js enviroments.

@kevinbarabash
Copy link

It might make sense to have a separate core-dom report for DOM related polyfills. I say this after having requested NodeList[Symbol.iterator] be added a while back. I think the reason why people make requests here is that there doesn't seem to be a corresponding repo for polyfilling DOM stuff. There are a bunch of little repos that polyfill different DOM things, but people don't want to have to go find each of these individual repos.

@elliolir
Copy link

It's 2017 and still no updates regarding this. Yeah, it's not a big problem since fetch-polyfill is available, but imo it's more convenient to have one package installed rather that two.

@jonaskuske
Copy link

It'd be also much more convenient because then babel-polyfill could automatically polyfill fetch depending on your browserlist so you wouldn't have to add/remove the fetch polyfill depending on your target browsers...

@chicoxyzzy
Copy link
Contributor Author

Actually babel-polyfill could do this using any other polyfill. Not sure that it should though but it's better to create such issue (if it doesn't exist yet) in Babel repo

@imprfekt
Copy link

It's 2018 and still no updates regarding this. Yeah, it's not a big problem since fetch-polyfill is available, but imo it's more convenient to have one package installed rather that two.

@loganfsmyth
Copy link
Contributor

@precompiled I think the original logic still holds. The fetch API is not part of the ECMAScript spec, so it doesn't really make sense to have in this repository. For the same reason, it's also not something I'd expect to be part of @babel/polyfill. Babel's objective is to polyfill language-standard features. Adding this would be no different than if core-js tried to polyfill require('url') or require('path') modules, or MutationObserver or any number of other environment-specific APIs.

@chicoxyzzy
Copy link
Contributor Author

chicoxyzzy commented Oct 19, 2018

@loganfsmyth BTW core-js already includes polyfills for non-ES things
https://github.com/zloirock/core-js#web-standards

@loganfsmyth
Copy link
Contributor

That's true, but I also think the average dev considers setTimeout/setImmediate to be part of ECMAScript even while that may not technically be the case. I guess what I should say is that I'd consider the bar extremely high as far as cross-environment expectations go, and I don't think fetch meets those requirements.

@chicoxyzzy
Copy link
Contributor Author

IMO developers expect that babel-polyfill will cover everything based on browserslist config. I see the reason why fetch is not in core-js, but considering that timeouts and DOM iterations are covered, missing fetch becomes non obvious issue.

@lake2
Copy link

lake2 commented Dec 27, 2020

same issue + 1

@Schweinepriester
Copy link
Contributor

Schweinepriester commented Feb 24, 2022

It's missing because currently core-js adds only cross-platform features, not browser-only or server-only.

fetch has now (experimentally) been added to node in nodejs/node@6ec2253.

@1593292349
Copy link

Expect this polyfills

@lekoaf
Copy link

lekoaf commented Feb 14, 2023

Expect this polyfills

https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md

@Bessonov
Copy link

@1593292349 what is your use case? Otherwise I think the issue should be closed.

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

No branches or pull requests