A lightweight Promise implementation in NodeJS
$ npm install a-promise
An extremely lightweight Promise Polyfill for Node and Browsers. It doesn't support all the features yet, but It supports what a normal person needs to keep the code clean. If you need something added, just open an issue.
npm install a-promise
In case you don't know what Promises are, then this example should give you a basic intro.
function MyFunction(Num){
return new Promise(function(Resolve, Reject){
// Do something asyncly
Resolve(Num * 100);
});
}
MyFunction(5).then(function(Result){
console.log(Result); // Outputs 500
});
© 2010 - cnpmjs.org x YWFE | Home | YWFE