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.
- Q.js Library
- When.js Library
- 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).