GithubHelp home page GithubHelp logo

es6-promise's Introduction

ES6-Promise (subset of rsvp.js)

This is a polyfill of the ES6 Promise. The implementation is a subset of rsvp.js, if you're wanting extra features and more debugging options, check out the full library.

For API details and how to use promises, see the JavaScript Promises HTML5Rocks article.

Downloads

Node.js

To install:

npm install es6-promise

To use:

var Promise = require('es6-promise').Promise;

Usage in IE<9

catch is a reserved word in IE<9, meaning promise.catch(func) throws a syntax error. To work around this, use a string to access the property:

promise['catch'](function(err) {
  // ...
});

Or use .then instead:

promise.then(undefined, function(err) {
  // ...
});

Auto-polyfill

To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet:

require('es6-promise').polyfill();

Notice that we don't assign the result of polyfill() to any variable. The polyfill() method will patch the global environment (in this case to the Promise name) when called.

Building & Testing

  • npm run build-all && npm test - Run Mocha tests through Node and PhantomJS.

es6-promise's People

Contributors

azu avatar cyril-sf avatar domenic avatar fivetanley avatar gr0uch avatar jakearchibald avatar jimt avatar joliss avatar josh avatar joshnesbitt avatar karlbohlmark avatar lukemelia avatar machty avatar matthew-andrews avatar mikepmunroe avatar nmn avatar pangratz avatar rwaldron avatar rwjblue avatar ryanflorence avatar sandstrom avatar stefanpenner avatar teddyzeenny avatar thomasboyt avatar tomdale avatar twokul avatar ukyo avatar wagenet avatar wibblymat avatar wycats avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.