gleam/javascript/promise

Types

pub external type Promise(value)

Functions

pub external fn await2(
  Promise(a),
  Promise(b),
) -> Promise(#(a, b))
pub external fn await3(
  Promise(a),
  Promise(b),
  Promise(c),
) -> Promise(#(a, b, c))
pub external fn await4(
  Promise(a),
  Promise(b),
  Promise(c),
  Promise(d),
) -> Promise(#(a, b, c, d))
pub external fn await5(
  Promise(a),
  Promise(b),
  Promise(c),
  Promise(d),
  Promise(e),
) -> Promise(#(a, b, c, d, e))
pub external fn await6(
  Promise(a),
  Promise(b),
  Promise(c),
  Promise(d),
  Promise(e),
  Promise(f),
) -> Promise(#(a, b, c, d, e, f))
pub external fn await_array(
  Array(Promise(a)),
) -> Promise(Array(a))
pub fn await_list(xs: List(Promise(a))) -> Promise(List(a))
pub external fn map(Promise(a), fn(a) -> b) -> Promise(b)
pub fn map_try(promise: Promise(Result(a, b)), callback: fn(a) ->
    Result(c, b)) -> Promise(Result(c, b))
pub external fn rescue(
  Promise(value),
  fn(Dynamic) -> value,
) -> Promise(value)
pub external fn resolve(value) -> Promise(value)
pub fn tap(promise: Promise(a), callback: fn(a) -> b) -> Promise(
  a,
)
pub external fn then(
  Promise(a),
  fn(a) -> Promise(b),
) -> Promise(b)
pub fn then_try(promise: Promise(Result(a, b)), callback: fn(a) ->
    Promise(Result(c, b))) -> Promise(Result(c, b))
Search Document