API / Js / Promise

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

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

error

RESCRIPT
type error = Js_promise2.error

make

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

resolve

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

reject

RESCRIPT
let reject: exn => promise<'a>

all

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

all2

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

all3

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

all4

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

all5

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

all6

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

race

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

then_

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

catch

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

unsafe_async

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

unsafe_await

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