A tiny Promises/A+ compliant implementation inspired by the official Crayola color.
npm install robin-egg-bluebird
then:
var Promise = require('robin-egg-bluebird');
var myPromise = new Promise(function(resolve, reject) {
// do something async...
if (error) {
reject(error);
}
resolve(successfulValue); // Pass to .then handler
});
myPromise().then(function(success) {
// success is successfulValue from above
});
Created with help of the Promises/A+ test suite