Skip to content

markjlu/es6-promise

 
 

Repository files navigation

ES6-Promises (subset of rsvp.js)

This is a polyfill of ES6 Promises. 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<10

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

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

Or use .then instead:

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

Building & Testing

This package uses the grunt-microlib package for building.

Custom tasks:

  • grunt test - Run Mocha tests through Node and PhantomJS.
  • grunt test:phantom - Run Mocha tests through PhantomJS (browser build).
  • grunt test:node - Run Mocha tests through Node (CommonJS build).

About

A polyfill for ES6-style Promises

Resources

License

Stars

Watchers

Forks

Packages

No packages published