pzero

Small promise lib

npm install pzero
37 downloads in the last month

Promises/A+ logo

pzero build status

API extentions for p0 A+ promises

How to use

Node

Install it with NPM or add it to your package.json:

npm install pzero

Then:

var pzero = require('pzero');

Browser

<script src="pzero.js"></script>

Api

var promise1 = pzero();
var promise2 = pzero();

pzero
    .when([promise1, promise2])
    .then( 
        function(values) {
            var value1 = values[0];
            var value2 = values[1];
        },
        function(reason) {}
    );

promise1
    .fail(function(reason) {});

promise1.callback(function(reason, value) {});

var cb = promise1.callback();
// reject promise -> cb(reason);
// fulfill promise -> cb(null, value);
npm loves you