https://github.com/dresende/node-fulfill
NodeJS Promises/A+
https://github.com/dresende/node-fulfill
Last synced: 11 months ago
JSON representation
NodeJS Promises/A+
- Host: GitHub
- URL: https://github.com/dresende/node-fulfill
- Owner: dresende
- Created: 2013-08-28T23:08:57.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-08-28T23:14:52.000Z (over 12 years ago)
- Last Synced: 2025-02-02T15:35:28.715Z (11 months ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
## NodeJS Promises/A+
### Install
```js
npm install fulfill
```
### Example
```js
var Promise = require("fulfill");
var duplicate = function (value) {
return new Promise(function (p) {
setTimeout(function () {
return p.fulfill(p * 2);
}, 500);
});
};
duplicate(5).then(function (value) {
return duplicate(value); // value = 10
}).then(function (value) {
console.log(value); // value = 20
});
```