Code Monkey home page Code Monkey logo

Comments (6)

josh08h avatar josh08h commented on June 27, 2024

Bump.

from fetch-retry.

jonbern avatar jonbern commented on June 27, 2024

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.

ptolemybarnes avatar ptolemybarnes commented on June 27, 2024

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.

jonbern avatar jonbern commented on June 27, 2024

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.

ptolemybarnes avatar ptolemybarnes commented on June 27, 2024

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.

jonbern avatar jonbern commented on June 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.