I have a div in js_of_ocaml which I want to assign an onmouseover event, like
deck_div##onmouseover <- (fun () -> (* do stuff *) )
However, the function type expected is
(Dom_html.divElement Js.t, Dom_html.mouseEvent Js.t) Dom_html.event_listener
How to construct this event listener? deck_div
has no method addEventListener
.
I was thinking about same question some months ago and AFAIR I have succeeded with Html.handler. Maybe this example will help you
https://github.com/ocsigen/js_of_ocaml/blob/master/examples/hyperbolic/hypertree.ml#L276