Comments (6)
Bump.
from fetch-retry.
I agree that it would be great to be able to remove the es6-promise
dependency.
Do you have any suggestions for an elegant way for the consumer to provide a promise polyfill?
As far as I can tell, it's currently only IE that lacks Promise
functionality, which means it still needs to be provided for backwards functionality. At the same time, I feel that having to provide a Promise
dependency in the constructor function is somewhat clunky.
Maybe it would be a better approach to try to find a more lightweight Promise polyfill? es6-promise is currently 315 kB, while promise-polyfill is 42.5 kB (https://www.npmjs.com/package/promise-polyfill).
from fetch-retry.
Hey @jonbern, what do you think about pushing the responsibility of polyfilling Promise on to the consumer? The way I see it fetch-retry
is a small package for doing a very specific job and needn't be concerned with polyfilling the environment. https://github.com/matthew-andrews/isomorphic-fetch has the same policy (though perhaps bad example, looks unmaintained).
This would be a breaking change of course.
from fetch-retry.
I think that's a very valid point.
Given that all browsers except IE support promises, and also that IE is the only browser that doesn't support the Fetch API, I would think it should be safe to leave responsibility of adding the necessary polyfills to the user code.
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
from fetch-retry.
I guess yet another option would be to offer 2 exports: one with the polyfill and one without (a bit like cross-fetch). That way you could avoid a breaking change. Still, for the reasons I already mentioned I would probably take the breaking change to remove the dependency altogether.
from fetch-retry.
I have created a new major version without the es6-promise dependency.
Thanks for bringing up the issue, and for providing valuable input and good suggestions.
https://github.com/jonbern/fetch-retry/releases/tag/4.0.0
from fetch-retry.
Related Issues (20)
- Consider transpiling to ES5? HOT 4
- If I wanted to recreate the default behavior of retryOn with a custom retryOn function, could I? HOT 1
- Retry on AbortController.abort() HOT 1
- How to refresh access token before the next retry HOT 8
- [Feature-Request] Compatability with browsers' fetch API HOT 1
- When function is provided to `retryOn`, retries value is not honored HOT 3
- 5.0.0 doesn't work in Node environment (e.g. with `node-fetch`) HOT 4
- Type error with node-fetch HOT 1
- 307 Redirect HOT 1
- Change url? HOT 1
- Browser usage HOT 4
- Set up Fetch-retry HOT 2
- Access current URL in custom retryOn HOT 5
- I want to update fetch-retry after v3 but it didn't work HOT 2
- docs: works with native fetch? HOT 3
- Question about 'retryOn'? HOT 1
- incopatibility with `@types/[email protected]` or `@types/[email protected]` HOT 2
- Suggestion: Add an onRetry callback for reporting/logging HOT 2
- upgrade guide to v6 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fetch-retry.