@kilt/parole

Another ES6 promise implementation (compliant with Promises/A+)

Stats

StarsIssuesVersionUpdatedCreatedSize
@kilt/parole
221.1.303 years ago3 years agoMinified + gzip package size for @kilt/parole in KB

Readme

Parole

Promises/A+ logo

Another ES6 promise implementation (compliant with Promises/A+)

ᴋɪʟᴛ ᴊs npm Build Status GitHub license

Installation

npm install parole --save

# alternatively you can use bower (minified version by default)
bower install parole --save

ES6 fulfill

Parole implements ES6 Promise specs

// parole respects the es6 promise specification
// you can use parole as global polyfill

if( !window.Promise ) {
  window.Promise = Parole;
}

Example

new Parole(function (resolve, reject) {
        resolve('gogogo!');
    })

    .then(function (result) {
        console.log('checkpoint 1', result);
        throw 'whoops!';
    })

    .then(function (result) {
        console.log('checkpoint 2', result);
    },function (result) {
        console.log('checkpoint 2.1', result);
        return new Parole(function (resolve, reject) {
            setTimeout(function () { resolve('all right!'); }, 400);
        });
    })

    .then(function (result) {
        console.log('checkpoint 3', result);
    }, function (reason) {
        console.log('checkpoint 3.1', reason);
    })
;

output

checkpoint 1 gogogo!
checkpoint 2.1 whoops!
# elapsed 400ms
checkpoint 3 all right!

Tests

make test

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.