Promises in the JS ecosystem and their native/emulated availability

So we’ve had a native implementation of promises, specifically the Promise type, in Node starting with version 4, and for the longest time in Firefox, Chrome, Safari, Edge and Opera. IE doesn't have it (not even IE11), on par with just about anything that came after ES5 in 2009.

When you don't have native promises available, a ton of modules provide them, but you might also want to use these modules instead of native promises, be it for pure performance reasons or due to extra features they provide.

Two popular modules shipped in 2012: Q, by Kris Kowal, had a lot of wind in its sails for a while but is now quite passé, and RSVP, by Yehuda Katz (of Rails, jQuery and Ember fame, also a TC39 member). RSVP is a tiny library that provides a performant implementation of Promises/A+ with a few bonus features, and remains super popular to this day. Its core feature set, which is just Promises/A+ without any extras, is also available as the standalone es6-promise and is the de facto polyfill for that part of the language.

Bluebird is undoubtedly the most famous promise library today, it's by Petka Antonov and is generally reported as the most performant. Do understand we're talking about shaving these last few microseconds off here, which is not always necessary, especially considering that the async/await syntax, which we'll see in part three of this course, sometimes gets even high perf out of the box.

That being said, besides stellar performance (which sometimes comes at the cost of diverging from the standard's way of doing things), people also love Bluebird for the ton of little utility functions it comes with, both for writing your program and for instrumenting and debugging it.

Finally, barely a month before this recording, the famous Async library by Caolan McMahon, that provides just about any conceivable algorithm for callback-based asynchrony, shipped its version 3 that makes all of its utilities compatible with promises! Now that is very, very cool!

Writing Modern Async JavaScript

From raw callbacks to promises to async/await, everything you need to master async JS code with ease!

Already enrolled?
Sign in to continue learning.