JSPM

  • Created
  • Published
  • Downloads 15620312
  • Score
    100M100P100Q215951F
  • License MIT

A minimal and fast promise implementation

Package Exports

  • lie

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lie) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lie

Promises/A+ logo

lie a small, performant, promise library implementing the Promises/A+ spec Version 1.1.

A originally a fork of Ruben Verborgh's library called promiscuous, version 2.6 and above are forked from ayepromise by Chris Burgmer.

API

by default adds a function called 'Promise' to the global scope (or if you grab the noConflict version than one called Lie)

return a promise

new Promise(function(resolve, reject){
    doSomething(function(err, result) {
        if (err) {
            reject(err);
        } else {
            resolve(result);
        }
    });
}).then(function (value) {
    //on success
}, function (reason) {
    //on error
}).catch(function (reason) {
    //short cut for error handling
});

Promise.all([
    //array of promises or values
]).then(function ([/* array of results */]));

##node

install with npm install lie, exactly the same as above but

var promise = require('lie');