UI for Zipcoin Blue
Tennessee Gibbs 0304752480 added pages to master 6 anos atrás
..
dist added pages to master 6 anos atrás
lib added pages to master 6 anos atrás
test added pages to master 6 anos atrás
.jshintrc added pages to master 6 anos atrás
.npmignore added pages to master 6 anos atrás
.travis.yml added pages to master 6 anos atrás
AUTHORS added pages to master 6 anos atrás
README.md added pages to master 6 anos atrás
bower.json added pages to master 6 anos atrás
component.json added pages to master 6 anos atrás
license.md added pages to master 6 anos atrás
package.json added pages to master 6 anos atrás
polyfill.js added pages to master 6 anos atrás

README.md

lie

<img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png"

   alt="Promises/A+ logo" title="Promises/A+ 1.1 compliant" align="right" />

Build Status

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.

npm install lie

var Promise = require('lie');
// or use the pollyfill
require('lie/polyfill');

Usage

Either use it with browserify (recommended) or grab one of the files from the dist folder

  • lie.js/lie.min.js makes 'Promise' available in global scope (or since it's a UMD Promise will be available through a CJS or AMD loader if it's available instead)
  • lie.polyfill.js/lie.polyfill.min.js adds 'Promise' to the global scope only if it's not already defined (not a UMD).

API

Implements the standard ES6 api,

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) {
    //shortcut for error handling
});

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

Promise.race([
    //array of promises or values
]);
// either resolves or rejects depending on the first value to do so

Unhandled Rejections

In node lie emits unhandledRejection events when promises are not handled in line with how iojs does so meaning it can act as promise shim in node as well as the browser.