https://github.com/imiric/es6-promise
A polyfill for ES6-style Promises, tracking rsvp
https://github.com/imiric/es6-promise
Last synced: about 1 month ago
JSON representation
A polyfill for ES6-style Promises, tracking rsvp
- Host: GitHub
- URL: https://github.com/imiric/es6-promise
- Owner: imiric
- License: mit
- Created: 2014-02-26T22:27:07.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-02-26T22:27:29.000Z (over 12 years ago)
- Last Synced: 2026-01-13T07:45:21.197Z (6 months ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ES6-Promises
This is a polyfill of
[ES6 Promises](https://github.com/domenic/promises-unwrapping). The implementation
is basically an API remapping of [rsvp.js](https://github.com/tildeio/rsvp.js).
For API details and how to use promises, see the
[JavaScript Promises HTML5Rocks article](http://www.html5rocks.com/en/tutorials/es6/promises/).
This repo is a [component(1)](http://component.io) wrapper around the work
@jakearchibald did at the
[original repo](https://github.com/jakearchibald/es6-promise). All credit goes
out to him.
## Installation
Install with [component(1)](http://component.io):
$ component install imiric/es6-promise
## API
```js
var promise = require('es6-promise');
promise.polyfill(); // setup polyfill or fallback to native implementation
// use as per the spec
var p = new Promise(function(resolve, reject) {
// do a thing, possibly async, then...
if (/* everything turned out fine */) {
resolve("Stuff worked!");
}
else {
reject(Error("It broke"));
}
});
```
## License
[MIT](LICENSE)