package d3

  1. Overview
  2. Docs

Event handlers

type ('event, 'a) handler = 'event Js.t -> 'a -> int -> unit

The type of an event handler. The handler expects an event of type 'event that it can interact with via the js_of_ocaml API, as well as data of type 'a to be associated with the DOM node that produced the event.

Mouse events

val click : (Dom_html.mouseEvent, 'a) handler -> ('a, 'a) t
val dblclick : (Dom_html.mouseEvent, 'a) handler -> ('a, 'a) t
val mousedown : (Dom_html.mouseEvent, 'a) handler -> ('a, 'a) t
val mouseup : (Dom_html.mouseEvent, 'a) handler -> ('a, 'a) t
val mouseover : (Dom_html.mouseEvent, 'a) handler -> ('a, 'a) t
val mousemove : (Dom_html.mouseEvent, 'a) handler -> ('a, 'a) t
val mouseout : (Dom_html.mouseEvent, 'a) handler -> ('a, 'a) t

Keyboard events

val keypress : (Dom_html.keyboardEvent, 'a) handler -> ('a, 'a) t
val keydown : (Dom_html.keyboardEvent, 'a) handler -> ('a, 'a) t
val keyup : (Dom_html.keyboardEvent, 'a) handler -> ('a, 'a) t

Drag-and-drop events

val dragstart : (Dom_html.dragEvent, 'a) handler -> ('a, 'a) t
val dragend : (Dom_html.dragEvent, 'a) handler -> ('a, 'a) t
val dragenter : (Dom_html.dragEvent, 'a) handler -> ('a, 'a) t
val dragover : (Dom_html.dragEvent, 'a) handler -> ('a, 'a) t
val dragleave : (Dom_html.dragEvent, 'a) handler -> ('a, 'a) t
val drag : (Dom_html.dragEvent, 'a) handler -> ('a, 'a) t
val drop : (Dom_html.dragEvent, 'a) handler -> ('a, 'a) t

Miscellaneous events

val input : (Dom_html.event, 'a) handler -> ('a, 'a) t
val timeupdate : (Dom_html.event, 'a) handler -> ('a, 'a) t
val change : (Dom_html.event, 'a) handler -> ('a, 'a) t
val focus : (Dom_html.event, 'a) handler -> ('a, 'a) t
val blur : (Dom_html.event, 'a) handler -> ('a, 'a) t
val scroll : (Dom_html.event, 'a) handler -> ('a, 'a) t
val submit : (Dom_html.event, 'a) handler -> ('a, 'a) t
val select : (Dom_html.event, 'a) handler -> ('a, 'a) t
val mousewheel : (Dom_html.event, 'a) handler -> ('a, 'a) t

Generic events

val handle : string -> (Dom_html.event, 'a) handler -> ('a, 'a) t
OCaml

Innovation. Community. Security.