API / Js / Promise2

Promise2

Provide bindings to JS Promise

t

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

error

RESCRIPT
type error

then

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

Type-safe t-first then

catch

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

Type-safe t-first catch

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>

unsafe_async

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

unsafe_await

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