gleam/javascript/promise

Types

pub type Promise(value)

Functions

pub fn await(a: Promise(a), b: fn(a) -> Promise(b)) -> Promise(b)
pub fn await2(a: Promise(a), b: Promise(b)) -> Promise(#(a, b))
pub fn await3(
  a: Promise(a),
  b: Promise(b),
  c: Promise(c),
) -> Promise(#(a, b, c))
pub fn await4(
  a: Promise(a),
  b: Promise(b),
  c: Promise(c),
  d: Promise(d),
) -> Promise(#(a, b, c, d))
pub fn await5(
  a: Promise(a),
  b: Promise(b),
  c: Promise(c),
  d: Promise(d),
  e: Promise(e),
) -> Promise(#(a, b, c, d, e))
pub fn await6(
  a: Promise(a),
  b: Promise(b),
  c: Promise(c),
  d: Promise(d),
  e: Promise(e),
  f: Promise(f),
) -> Promise(#(a, b, c, d, e, f))
pub fn await_array(a: Array(Promise(a))) -> Promise(Array(a))
pub fn await_list(xs: List(Promise(a))) -> Promise(List(a))
pub fn map(a: Promise(a), b: 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 fn new(a: fn(fn(a) -> Nil) -> Nil) -> Promise(a)
pub fn rescue(a: Promise(a), b: fn(Dynamic) -> a) -> Promise(a)
pub fn resolve(a: a) -> Promise(a)
pub fn tap(
  promise: Promise(a),
  callback: fn(a) -> b,
) -> Promise(a)
pub fn try_await(
  promise: Promise(Result(a, b)),
  callback: fn(a) -> Promise(Result(c, b)),
) -> Promise(Result(c, b))
Search Document