ES5 vs ES6 Promises

I want to know if JS promises were part of es5? If so, why doesn't this work sometimes in older browsers, and we need to add a polyfill for this. Also, in this case, should add polyfill, es5 one or es6? I have a little confusion about the same.

+6
source share
1 answer

There were no promises in ES5. Libraries like jQuery or Angular had their own and custom implementations.

Popular Promise implementations for use with ES5 are Bluebird (compatible with the ES6 standard) and Q (which was not originally compatible with the ES6 standard, although it seems to be moving in that direction) and RSVP.

They are also not actual polyfolms, since they do not get out of the way if native promises are present, because they add additional functions.

There are some pure polyfillings for ES6 promises. Here is one that is a subset of RSVP: https://github.com/stefanpenner/es6-promise .

There are reasons to use more than polyfill, as you can read here: Are there any other reasons to use promise libraries like Q or BlueBird, now we have ES6 promises?

Requesting recommendations for a particular polyfill library is covered in the Stack Overflow section, so I won’t comment on this.

+21
source

All Articles