impossible-promise
v0.8.0
Published
wrapper used to chain native Promises in an async sequence
Readme
(IM)POSSIBLE PROMISE
wrapper used to chain native Promises in an async sequence
Instal from NPM
requires node -v >4.3.2 (for Promises support)
$ npm install impossible-promiseUsage:
use new sequence() and .then() to chain promises
use .done() to fetch all results
var sequence = require("impossible-promise")
new sequence((next,reject) => {
next("giving");
}).then((next,reject) => {
setTimeout(() => next("is") , 1000);
}).then((next,reject) => {
next("caring!");
}).done((a,b,c) => {
console.log([a,b,c].join(" "));
// => giving is caring!
});Documentation
check test.js for examples
TODO:
- [ ] propper documentation
- [x] backwards compatibility
- [ ] browser compatibility
- [ ] support for
Promise.race() - [x] support for
Promise.all() - [x] added .promisify()
- [x] added .pipe()
- [x] allows new ImpossibePromise() without arguments
- [x] allows .then(new ImpossibePromise())
- [x] allows multiple .done()
- [ ] write a CONTRIBUTING.file
LICENSE
MIT, see LICENSE for details.
