KO
|
EN
gitlite — search
Search
#python
#java
#python3
#arduino
#golang
#machine-learning
#rust
#html
#flask
#javascript
#seismology
#nodejs
promise.js
★ 11
Open GitHub ↗
No longer under active development!
Download README (.md)
Explore Similar Repositories
mbtawesome
:
An MBTA subway status application with a good attitude
gradle-plugins
:
Collection of various Gradle Plugins
django-uwkhtmltopdf
:
A Django app to generate pdfs from templates using wkhtmltopdf
ERVolumeAdjust
:
This fills a gap in AVFoundation (OSX), allowing an app to control the input volume of an audio device.
LargeDatasetSample
:
iOS Large Dataset Sample - Core Data and NSFetchedResultsController with search (like Contacts in Phone application)
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
promise.js
?
Download (.md)
# promise.js is no longer under active development! [jarchibald/ES6-Promises](https://github.com/jakearchibald/ES6-Promises) does everything this library was set out to do. # promise.js [<img align="right" alt="Promises/A+ 1.0 compliant" src="http://promisesaplus.com/assets/logo-small.png">](http://promisesaplus.com/) A Minimal, fully Promises/A+ compliant library. Promises/A+ spec here: http://promisesaplus.com/ [](https://travis-ci.org/potch/promise.js) # Usage * `promise()` - Creates a promise. Can pass an optional `obj` argument. If passed, promise methods are attached to passed object. * `promise.isPromise(obj)` - Uses duck-typing to check whether the given object is a 'promise' (does it have a `then` method?) * `promise.avow(fn)` - wrap a function in a promise. Use like so: ```js var add = promise.avow(function (fulfill, reject, a, b) { if (a <= 2 && b <= 2) { fulfill(a + b); } else { reject('Math is hard.'); } }); add(1, 1).then(console.log); ``` ## Promise Methods * `then(onFulfill, onReject)` - bind fulfillment/rejection handlers to the promise. Returns a promise object * `fulfill(value)` - fulfills the promise with the passed value. * `reject(reason)` - rejects the promise with the passed reason. For all behaviors, see the [spec](http://promisesaplus.com/ "Promises/A+ Specification").