pretty-promise
Small and lightweight implementation of Promises A/+.
var pp = var promise = promise
installation
npm install pretty-promise --save
tests
Pretty Promise uses the Promises A/+ Compliance Tests.
Before you run the tests, you need to install all devDependencies:
npm install
Then, just run:
npm test
api
pp(resolver) -> Promise
You can create promises with a resolver
function:
{ return }
Or you can use a Defer-like syntax:
{ var promise = // ... if !err promise else promise return promise}
pp#then(onFulfilled, onRejected) -> Promise
Add the promise's handlers.
pp#catch(onRejected) -> Promise
A shortcut for promise.then(null, onRejected)
.
todo
- Implements Promises A/+ spec.
- Implements
catch(onRejected)
alias. - Implements
tp.when()
static method.
license
MIT