bs-promise
v0.3.1
Published
Bindings to promises for BuckleScript
Downloads
11
Readme
Official bindings to promises for BuckleScript.
Installation
npm: npm install bs-promise
Usage
Reason syntax:
let prom1 = Bs_promise.make (fun resolve reject => resolve "hello");
let prom2 = prom1
|> Bs_promise.then_ (fun res => {Js.log res; 123})
|> Bs_promise.then_ (fun res => print_int res);
OCaml syntax:
let prom1 = Bs_promise.make (fun resolve reject -> resolve "hello")
let prom2 = prom1
|> Bs_promise.then_ (fun res -> Js.log res; 123)
|> Bs_promise.then_ (fun res -> print_int res)
See more usage examples in test/
. The source is a single file!