Git Product home page Git Product logo

Comments (10)

statianzo avatar statianzo commented on July 30, 2024 1

I vote for the simple route of assuming the native Promise global exists. It's available on every modern platform and most polyfills support creating a global if necessary.

Using the babel plugin would force users into es6-promise even if they wanted to use bluebird or some other promise library.

from ajax.

fdaciuk avatar fdaciuk commented on July 30, 2024

Hi @banderso-n! This is the expected behaviour (for now).
The chainable .then implementation to work as Promises doesn't was implemented yet.

Feel free to send a pull request =)

from ajax.

statianzo avatar statianzo commented on July 30, 2024

@fdaciuk what are your thoughts on just using native promises?
http://caniuse.com/#feat=promises

from ajax.

fdaciuk avatar fdaciuk commented on July 30, 2024

I think so =)

But I think it will be better if something like babel promise plugin is used instead.

What do you think about it?

from ajax.

fdaciuk avatar fdaciuk commented on July 30, 2024

Make sense, but that's not enough =)
And if user haven't any other promise library included on project? Ajax must work even in this case.
The main idea from this library is that it abstracts XMLHttpRequest, using Promises - or something like xD

I thought in create a mini library, based on Promise/A+ spec to solve this.

from ajax.

statianzo avatar statianzo commented on July 30, 2024

If they don't have a promise polyfill included and they have to support legacy environments without native Promises built in then they should use a polyfill. There shouldn't be a need to create another promise library, there are already quite a few popular choices:

https://github.com/stefanpenner/es6-promise
https://github.com/petkaantonov/bluebird
https://github.com/tildeio/rsvp.js
https://github.com/then/promise
https://github.com/stackp/promisejs
...and the list goes on

If ajax were to pick a promise library (or create its own), then users of a different promise library would need to have 2 promise libraries loaded. By assuming a Promise global (or possibly passing in an option to ajax()), it gives more control to users.

from ajax.

statianzo avatar statianzo commented on July 30, 2024

Opened #38 as a discussion point.

from ajax.

kenberkeley avatar kenberkeley commented on July 30, 2024

the non-standard promise almost ruined my project...

from ajax.

fabiocbinbutter avatar fabiocbinbutter commented on July 30, 2024

@kenberkeley what did you end up doing/using instead?
I chased a bug caused by this for about an hour...

from ajax.

kenberkeley avatar kenberkeley commented on July 30, 2024

@fabiocbinbutter wrap with the native promise...

from ajax.

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.