javascript - js_of_ocaml and event_listener -
i have div in js_of_ocaml want assign onmouseover event, like
deck_div##onmouseover <- (fun () -> (* stuff *) )
however, function type expected
(dom_html.divelement js.t, dom_html.mouseevent js.t) dom_html.event_listener
how construct event listener? deck_div
has no method addeventlistener
.
i thinking same question months ago , afair have succeeded html.handler. maybe example you
https://github.com/ocsigen/js_of_ocaml/blob/master/examples/hyperbolic/hypertree.ml#l276
let handle_drag element move stop click = let fuzz = 4 in element##onmousedown <- html.handler (fun ev -> let x0 = ev##clientx , y0 = ev##clienty in ....
Comments
Post a Comment