package plotly
Binding for Plotly Open Source Graphing Library
Install
Dune Dependency
Authors
Maintainers
Sources
v1.0.0.tar.gz
md5=a3817f0fa4fb58615bfd7cb8e64f5856
sha512=40b0d2b4a3a33ae0d9eecdd39d233bfb072ac01cbfdaaad1fe10e0057a2ed9fadb685a9aed3b47cb7296757b78665b23630dc5a0a9bc3ec5f5a3f330c7c1c69d
doc/src/plotly.jsoo/jstools.ml.html
Source file jstools.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
open Js_of_ocaml module Html = Dom_html let from_Some = Option.get let from_Ok = Result.get_ok let from_js_Some x = from_Some @@ Js.Opt.to_option x let (!$) = Js.string let (?$) = Js.to_string module Console = struct let log a = Js_of_ocaml.Firebug.console##log a let logf fmt = Format.kasprintf (fun s -> log !$s) fmt end (* eprintf to console *) let () = let buf = Buffer.create 1024 in Format.pp_set_formatter_output_functions Format.err_formatter (Buffer.add_substring buf) (fun () -> Console.log !$(Buffer.contents buf); Buffer.clear buf) let alert s = Format.eprintf "%s@." s; Html.window##alert !$s let alertf fmt = Format.kasprintf (fun s -> alert s) fmt let show_as_json x = ?$(Js_of_ocaml.Json.output x) let pp_as_json ppf x = Format.pp_print_string ppf ?$(Js_of_ocaml.Json.output x) exception No_element_id of string let getById_exn n = match Html.getElementById n with | exception Not_found -> raise (No_element_id n) | x -> x let getById n = match Html.getElementById n with | exception Not_found -> None | x -> Some x let getById_coerce_exn coerce s = match Html.getElementById_coerce s coerce with | Some x -> x | None -> raise (No_element_id s) let getById_coerce coerce s = Html.getElementById_coerce s coerce let elem x = (x :> Html.element Js.t) let is_worker () = try ignore (Js.Unsafe.eval_string "window"); false with _ -> true let now () = new%js Js.date_now
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>