Module Brr.Ev

module Ev: sig .. end
DOM events


Events and event kinds


type #Dom_html.eventTarget target = (#Dom_html.eventTarget as 'a) Js.t 
The type for event targets.
type #Dom_html.event kind = (#Dom_html.event as 'a) Js.t Dom_html.Event.typ 
The type for kind of events. See Event kinds.
type #Dom_html.event t = (#Dom_html.event as 'a) Js.t 
The type for events.

Events as Note events


val for_target : ?capture:bool ->
?propagate:bool ->
?default:bool ->
#Dom_html.eventTarget target ->
(#Dom_html.event as 'a) kind -> ('a t -> 'c) -> 'c Note.event
for_target ~capture ~propagate ~default t k f is an event that reports events of kind k transformed by f on target t. If capture is true the event occurs during the capture phase (defaults to false). If propagate is true (default) the event is propagated. The default action is performed iff default is true (defaults to the value of propagate.
val for_targets : ?capture:bool ->
?propagate:bool ->
?default:bool ->
(#Dom_html.eventTarget as 'a) target list ->
(#Dom_html.event as 'b) kind ->
('a target -> 'b t -> 'c) -> 'c Note.event
Brr.Ev.for_targets is like Brr.Ev.for_target except the event occurs for the event kind on the given list of targets.
val for_el : ?capture:bool ->
?propagate:bool ->
?default:bool ->
Brr.El.t ->
(#Dom_html.event as 'a) kind -> ('a t -> 'c) -> 'c Note.event
for_el is like Brr.Ev.for_target except the target is an element.
val for_els : ?capture:bool ->
?propagate:bool ->
?default:bool ->
Brr.El.t list ->
(#Dom_html.event as 'a) kind ->
(Brr.El.t -> 'a t -> 'c) -> 'c Note.event
for_els is like Brr.Ev.for_targets excepts the targets are elements.

Event mappers


val ev : (#Dom_html.event as 'a) t -> 'a t
ev e is e.
val unit : #Dom_html.event t -> unit
unit e is ().
val stamp : 'a -> #Dom_html.event t -> 'a
stamp v e is v.

Event callbacks

Lower-level convenience interface.

type cb 
The type for event callbacks.
type cb_ret 
The type for callback return.
val add_cb : ?capture:bool ->
(#Dom_html.eventTarget as 'a) target ->
(#Dom_html.event as 'b) kind ->
('a target -> 'b t -> cb_ret) -> cb
add_cb ~capture t k f calls f e ev whenever an event ev of kind k occurs on t. If capture is true the callback occurs during the capture phase (defaults to false).
val rem_cb : cb -> unit
rem_cb cb removes the callback cb.
val cb_ret : ?propagate:bool -> ?default:bool -> #Dom_html.event t -> cb_ret
cb_ret ~propagate ~default ev returns from the callback and propagates event ev if propagate is true (default). The default action is performed iff default is true (defaults to the value of propagate.

Event kinds

MDN's web docs Event reference.

val kind : string -> #Dom_html.event kind
val abort : Dom_html.event kind
val afterprint : Dom_html.event kind
val beforeprint : Dom_html.event kind
val beforeunload : Dom_html.event kind
val blur : Dom_html.event kind
val cached : Dom_html.event kind
val change : Dom_html.event kind
val click : Dom_html.event kind
val dblclick : Dom_html.event kind
val domContentLoaded : Dom_html.event kind
val error : Dom_html.event kind
val focus : Dom_html.event kind
val hashchange : Dom_html.event kind
val input : Dom_html.event kind
val invalid : Dom_html.event kind
val keydown : Dom_html.keyboardEvent kind
val keypress : Dom_html.keyboardEvent kind
val keyup : Dom_html.keyboardEvent kind
val load : Dom_html.event kind
val message : Dom_html.event kind
val mousedown : Dom_html.mouseEvent kind
val mouseenter : Dom_html.mouseEvent kind
val mouseleave : Dom_html.mouseEvent kind
val mousemove : Dom_html.mouseEvent kind
val mouseout : Dom_html.mouseEvent kind
val mouseover : Dom_html.mouseEvent kind
val mouseup : Dom_html.mouseEvent kind
val offline : Dom_html.event kind
val online : Dom_html.event kind
val pagehide : Dom_html.event kind
val pageshow : Dom_html.event kind
val popstate : Dom_html.event kind
val readystatechange : Dom_html.event kind
val reset : Dom_html.event kind
val resize : Dom_html.event kind
val submit : Dom_html.event kind
val unload : Dom_html.event kind