API / Js / Js_promise

Js_promise

Deprecation note: These bindings are pretty outdated and cannot be used properly with the -> operator.

More details on proper Promise usage can be found here: https://rescript-lang.org/docs/manual/latest/promise#promise-legacy

t

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

error

type error = Js_promise2.error

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>

then_

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

catch

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

unsafe_async

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

unsafe_await

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