(* Simplest example *) open Js_of_ocaml module C = Js_top_worker_client_msg module Msg = Js_top_worker_message.Message let log s = Console.console##log (Js.string s) let log_output (o : C.output) = log ("stdout: " ^ o.stdout); log ("stderr: " ^ o.stderr); log ("caml_ppf: " ^ o.caml_ppf) let _ = let open Lwt.Infix in let t = C.create ~timeout:100000 "_opam/worker.js" in let config : Msg.init_config = { findlib_requires = []; stdlib_dcs = None; findlib_index = None } in C.init t config >>= fun () -> C.eval t ~env_id:"default" "2*2;;" >>= fun o -> log_output o; Lwt.return ()