https://github.com/xiaody/in-promise
A minimal Promises/A+ implementation for browsers
https://github.com/xiaody/in-promise
Last synced: over 1 year ago
JSON representation
A minimal Promises/A+ implementation for browsers
- Host: GitHub
- URL: https://github.com/xiaody/in-promise
- Owner: xiaody
- Created: 2015-07-13T08:33:35.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-04-01T06:41:36.000Z (about 9 years ago)
- Last Synced: 2025-02-16T08:07:27.839Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](http://badge.fury.io/js/in-promise)
[](https://travis-ci.org/xiaody/in-promise)
[](https://www.codacy.com/app/youyounaihe/in-promise)
[](http://codecov.io/github/xiaody/in-promise?branch=master)
[](https://david-dm.org/xiaody/in-promise)
[](https://david-dm.org/xiaody/in-promise#info=devDependencies)
in-promise is a minimal Promises/A+ implementation for browsers.
~700 bytes (gzip).
# API
It is really _minimal_, and only provides a ES6 style Promise constructor plus a Promises/A+ compatible `Promise#then` method:
```js
var p1 = new Promise(function (res, rej) {
setTimeout(function () {
res('Hello Promise')
}, 100)
})
var p2 = p1.then(function (value) {
console.log(value) // Hello Promise
})
```
This is no `Promise#catch` or `Promise.all` or `Promise.race` or ...
Just `Promise#then`.
For a polyfill for ES6 Promise, check the [es6 branch].
[es6 branch]: https://github.com/xiaody/in-promise/tree/es6