This is a JavaScript implementation of Promises/A+ spec, and adequately tested.
Also a full featured polyfill for ES6 Promise.
var Promise = require('promise-a-plus');
var promise1 = Promise.resolve('nice');
var promise2 = new Promise(function(resolve, reject) {
reject('just rejected');
});
Promise.race([promise1, promise2]).then(console.log.bind(console));
If you want to use in browser, use tools like webpack
or browserify
.
The library's API is absolutely consistent with official API.
Also view wiki.
Copyright (c) 2015 creeperyang. Licensed under the MIT license.