Module: legio-async/promise

legio-async/promise

new (require("legio-async/promise"))()

Source:
Source:

Members

awaiting :Thenable

Type:
  • Thenable
Source:

fulfilled :Boolean

Type:
  • Boolean
Source:

pending :Boolean

Type:
  • Boolean
Source:

rejected :Boolean

Type:
  • Boolean
Source:

Methods

(static) all(list) → {Promise}

Parameters:
Name Type Description
list Array.<Promise>
Source:
Returns:
Type
Promise

(static) allSettled(list) → {Promise}

Parameters:
Name Type Description
list Array.<Promise>
Source:
Returns:
Type
Promise

(static) when(thenable) → {Promise}

Parameters:
Name Type Description
thenable Thenable
Source:
Returns:
Type
Promise

bindFulfill() → {function}

Source:
Returns:
Type
function

bindNotify() → {function}

Source:
Returns:
Type
function

bindReject() → {function}

Source:
Returns:
Type
function

bindResolve() → {function}

Source:
Returns:
Type
function

catch()

Source:

done()

Source:

failed(onRejected) → {Promise}

Parameters:
Name Type Description
onRejected function
Source:
Returns:
Type
Promise

finally()

Source:

fulfill(value) → {Boolean}

Parameters:
Name Type Description
value *
Source:
Returns:
A boolean indicating whether the promise was fulfilled.
Type
Boolean

nodeifyResolve() → {function}

Returns a function in the node-async-style form which when called resolves the promise
Source:
Returns:
Type
function

nodeifyThen(fn) → {Promise}

Parameters:
Name Type Description
fn function A function in the node-async-style form (err, res)
Source:
Returns:
Type
Promise

notified(onNotified) → {this}

Parameters:
Name Type Description
onNotified function
Source:
Returns:
Type
this

notify(value) → {Boolean}

Parameters:
Name Type Description
value *
Source:
Returns:
A boolean indicating whether the promise was notified.
Type
Boolean

reject(reason) → {Boolean}

Parameters:
Name Type Description
reason *
Source:
Returns:
A boolean indicating whether the promise was rejected.
Type
Boolean

resolve(x)

Parameters:
Name Type Description
x *
Source:

run(fn) → {this}

Runs the given function after the fulfillment with the value as a parameter and stores the result as a new value.
Parameters:
Name Type Description
fn function
Source:
Returns:
Type
this

settled(onSettled) → {Promise}

Parameters:
Name Type Description
onSettled function
Source:
Returns:
Type
Promise

then(onFulfilledopt, onRejectedopt) → {Promise}

Parameters:
Name Type Attributes Description
onFulfilled function <optional>
onRejected function <optional>
Source:
Returns:
Type
Promise