short description
I am looking for the inverse of: async_js/main.ml at master · janestreet/async_js · GitHub
let promise_of_deferred d =
let promise = Js.Unsafe.global##._Promise in
new%js promise
(Js.wrap_callback (fun resolve (_reject : 'a) -> don't_wait_for (d >>| resolve)))
;;
context
I have a piece of JS code that is an async function
let js_code =
{|
(async function(...) { ... } )
|}
I compile this function with Js.Unsafe.js_expr js_code
, and when I call it from OCaml land, I get a promise back.
Question: how do I want on this promise from async_js Deferred.t ?
Thanks!