API / Js / Js_promise2

Js_promise2

t

type t<'a> = promise<'a>

error

type error

then

Type-safe t-first then

let then: (promise<'a>, 'a => promise<'b>) => promise<'b>

catch

Type-safe t-first catch

let catch: (promise<'a>, error => promise<'a>) => promise<'a>

make

let make: ((~resolve: (. 'a) => unit, ~reject: (. exn) => unit) => unit) => promise<'a>

resolve

let resolve: 'a => promise<'a>

reject

let reject: exn => promise<'a>

all

let all: array<promise<'a>> => promise<array<'a>>

all2

let all2: ((promise<'a0>, promise<'a1>)) => promise<('a0, 'a1)>

all3

let all3: ((promise<'a0>, promise<'a1>, promise<'a2>)) => promise<('a0, 'a1, 'a2)>

all4

let all4: ((promise<'a0>, promise<'a1>, promise<'a2>, promise<'a3>)) => promise<( 'a0, 'a1, 'a2, 'a3, )>

all5

let all5: ((promise<'a0>, promise<'a1>, promise<'a2>, promise<'a3>, promise<'a4>)) => promise<( 'a0, 'a1, 'a2, 'a3, 'a4, )>

all6

let all6: ( (promise<'a0>, promise<'a1>, promise<'a2>, promise<'a3>, promise<'a4>, promise<'a5>) ) => promise<('a0, 'a1, 'a2, 'a3, 'a4, 'a5)>

race

let race: array<promise<'a>> => promise<'a>

unsafe_async

let unsafe_async: 'a => promise<'a>

unsafe_await

let unsafe_await: promise<'a> => 'a