Bare bones Promises/A+ implementation / ES6 Promise polyfill
1.1.0
Constructor accepts two parameters: resolve and reject functions.
Value to resolve promise with
Is promise still pending (as opposed to resolved or rejected)
Is the promise fulfilled. Same as isResolved()
Is the promise resolved. Same as isFulfilled()
Is the promise rejected
Is the promise was destroyed before resolving or rejecting
Did someone subscribed to this promise
Resolve the promise
Reject the promise
-- called when this promise is resolved; returns new resolve value or promise
-- called when this promise is rejected; returns new reject reason
-- resolve's and reject's functions "this" object
Add reject listener.
-- same as then(null, reject)
Add resolve listener
-- function to call when promise is resolved
-- function's "this" object
Add reject listener
-- function to call when promise is rejected.
-- function's "this" object
Add both resolve and reject listener
-- function to call when promise resolved or rejected
-- function's "this" object
Get a thenable object
Resolve this promise after value promise is resolved.
Call function fn with given args in given context
and use its return value as resolve value for a new promise.
Then return this promise.
Create new promise and resolve it with given value
Create new promise and reject it with given reason
Take a list of promises or values and once all promises are resolved,
create a new promise and resolve it with a list of final values.
If one of the promises is rejected, it will reject the returned promise.
-- array of promises or resolve values
Same as all() but it treats arguments as list of values.
Same as all() but the resulting promise
will not be rejected if ones of the passed promises is rejected.
-- array of promises or resolve values
Given the list of promises or values it will return a new promise and resolve it with the first resolved value.
-- array of promises or resolve values
Takes a list of async functions and executes them in given order consequentially
-- array of promises or resolve values or functions
Works like Array.forEach but it expects passed function to return a Promise.
if true, the resulting promise will fail if one of the returned promises fails.
Returns a promise with additional countdown
method. Call this method cnt times and
the promise will get resolved.
-- called when this promise is resolved; returns new resolve value or promise
-- called when this promise is rejected; returns new reject reason
-- resolve's and reject's functions "this" object
Add resolve listener
-- function to call when promise is resolved
-- function's "this" object
Add both resolve and reject listener
-- function to call when promise resolved or rejected
-- function's "this" object
Add reject listener
-- function to call when promise is rejected.
-- function's "this" object