beauty-promise
v1.2.3
Published
Implementation of javascript Promise
Downloads
6
Readme
Promise
Implementation of javascript Promise/A+ standard, plus .finally and onUnhandledRejection.
Nothing more. Clean and tiny (4.5 KB Only).
Use it by: npm install all-promise, or include browser-bundles/promise.min.js.
Promise API
Constructor
new Promise(fn: function(resolve, reject))Promise Instance Methods
promise.then(onFulfilled: null|function(value), onRejected: null|function(reason))promise.catch(onRejected: function(reason))promise.finally(onRejected: function(valueOrReason))Static Methods
Promise.resolve(value: *)Promise.reject(reason: *)Promise.all(promises: Array.<Promise | Thenable>)Promise.race(promises: Array.<Promise | Thenable>)Unhandled Promise Rejection
Promise.onUnhandledRejection = function (reason) {
// ... handle your unhandled rejection
};