lol bootstrap achieved... prob need to figure out how to use js_of_ocaml-ppx with it next
This commit is contained in:
13
toplevel.ml
13
toplevel.ml
@ -377,7 +377,7 @@ module History = struct
|
||||
textbox##.value := Js.string !data.(!idx))
|
||||
end
|
||||
|
||||
let run ~output () =
|
||||
let run ~init ~output () =
|
||||
Firebug.console##log "run";
|
||||
|
||||
let container = by_id "toplevel-container" in
|
||||
@ -511,6 +511,17 @@ let run ~output () =
|
||||
History.setup ();
|
||||
textbox##.value := Js.string "";
|
||||
(* Run initial code if any *)
|
||||
(try
|
||||
textbox##.value := Js.string init;
|
||||
Lwt.async (fun () ->
|
||||
execute (Js.to_string textbox##.value##trim) ())
|
||||
with
|
||||
| Not_found -> ()
|
||||
| exc ->
|
||||
Firebug.console##log_3
|
||||
(Js.string ".config/init.ml exception")
|
||||
(Js.string (Printexc.to_string exc))
|
||||
exc);
|
||||
try
|
||||
let code = List.assoc "code" (parse_hash ()) in
|
||||
textbox##.value := Js.string (B64.decode code);
|
||||
|
||||
Reference in New Issue
Block a user