JS Promise (Part 2 - Q.js, When.js and RSVP.js)

Dec 5, 20165 mins read

I would like to continue with an examination of JavaScript Promise API. Let’s have a look at Promise evolution by various libraries. below three libraries which we are going to explore on this article.

  1. Q.js Library
  2. When.js Library
  3. RSVP.js Library

Using q.js

The q.js is best one for promise implementation by Kris Kowal. It is more evident of promise evolution.

Lets have a look, What makes it special.

  • It provides two ways to define the promise. one is very famous by Q.defer() and another one is Q.Promise().
  • The Q.defer() method is custom and flexible way to define promise like defining anywhere in the code likevar deferred = Q.defer(); and any time that can be resolved, rejected and notified (deferred.resolve, deferred.reject, deferred.notify).