/p0

Minimal Promise/A+ 1.1 implementation.

Primary LanguageJavaScript

Promises/A+ logo p0 build status

Minimal and fast Promise/A+ 1.1 implementation. It's all you need to pass the tests and build your own extended API.

Installation

Node.js

npm install p0

Browser

<script src="p0/index.min.js"></script>

Usage

var p0 = require('./');

var promise1 = new p0();

var promise2 = promise1.then(
    null,
    function(reason) {
        var promise3 = new p0();
        setTimeout(function() {
            promise3.fulfill(reason + 'bar');
        }, 100);
        return promise3;
    }
);

promise1.reject('foo');

promise2.then(function(value) { console.log(value); });
// will output "foobar" after 100ms

Fill free to use specs as more descriptive documentation.

License

MIT