metaphorjs-promise
v1.2.0
Published
Bare bones Promises/A+ implementation / ES6 Promise polyfill
Downloads
3
Readme
7k minified.
####Constructor
new Promise(function(resolve, reject))
new Promise(thenable)
####Instance
promise.then(onFulfill, onReject)
-> new promisepromise.catch(onReject)
-> new promisepromise.resolve(value)
promise.reject(reason)
####Static
Promise.all(iterable)
-> new promisePromise.race(iterable)
-> new promisePromise.resolve(value)
-> new promisePromise.reject(reason)
-> new promise
Plus a few extra instance methods:
promise.done(onDone[, thisObject])
-> same promisepromise.fail(onFail[, thisObject])
-> same promisepromise.always(onFinished[, thisObject])
-> same promisepromise.promise()
-> thenablepromise.isPending()
promise.isFulfilled()
promise.isRejected()
And some extra class methods:
Promise.fcall(fn, context, args)
-> new promisePromise.allResolved(promises)
-> new promisePromise.when(promise1, promise2, ...)
-> new promisePromise.waterfall(functions)
-> new promisePromise.forEach(items, fn, context)
-> new promisePromise.counter(cnt)
-> new promise