ab-5v / p0

Minimal Promise/A+ 1.1 implementation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Minimal Promise/A+ 1.1 implementation.


Languages

Language:JavaScript 100.0%