Open bentxt opened 1 year ago
It would be a good addition.
Since JS-CPS backend provides delimited continuations, no new syntax needs to be added. Instead, some library functions like this will do:
type 'a promise
val asyncFunction : (JavaScript.value vector -> JavaScript.value) -> JavaScript.value
(* or val async : ('a -> 'b) -> 'a -> 'b promise *)
val await : 'a promise -> 'a
val createPromise : ({ resolve : 'a -> unit, reject : exn -> unit } -> unit) -> 'a promise
Hi, I just wanted to ask if javascript sync/await syntax is something you might add someday. Thanks Ben