Comments (10)
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.
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.
@fdaciuk what are your thoughts on just using native promises?
http://caniuse.com/#feat=promises
from ajax.
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.
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.
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.
Opened #38 as a discussion point.
from ajax.
the non-standard promise almost ruined my project...
from ajax.
@kenberkeley what did you end up doing/using instead?
I chased a bug caused by this for about an hour...
from ajax.
@fabiocbinbutter wrap with the native promise...
from ajax.
Related Issues (20)
- Support to withCredentials HOT 1
- Add jsonp method HOT 2
- Error HOT 13
- Add non-minified source on NPM HOT 1
- "Promise" api is not a proper thenable HOT 1
- mothed "GET" no param request. HOT 1
- Get HTML data HOT 1
- Missing character causes error HOT 7
- Add PATCH support HOT 5
- Call blocked: Origin 'null' is therefore not allowed access HOT 1
- Use fetch with XMLHttpRequest fallback? HOT 3
- Browser logos are broken on README HOT 1
- add 'get' data support HOT 1
- Posso trocar o ajaxForm() do jQuery por essa lib? HOT 2
- Send [object object] from method PUT HOT 4
- ES6 / ES2015 module import HOT 1
- Shouldn't 2.3.1 be a new minor version? HOT 3
- Is this ajax use cache? HOT 1
- Error when using method options HOT 4
- content-type: x-www-form-urlencoded error
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 ajax.