module Lwt_js_events:Programming mouse or keyboard events handlers using Lwtsig..end
val preventDefault : #Dom_html.event Js.t -> unitDom_html.stopPropagation.val make_event : (#Dom_html.event as 'a) Js.t Dom_html.Event.typ ->
?use_capture:bool -> #Dom_html.eventTarget Js.t -> 'a Js.t Lwt.tmake_event ev target creates a Lwt thread that waits
for the event ev to happen on target (once).
This thread is cancellable using
.
If you set the optional parameter ~use_capture:true,
the event will be caught during the capture phase,
otherwise it is caught during the bubbling phase
(default).val seq_loop : ?cancel_handler:bool ->
(?use_capture:bool -> 'a -> 'b Lwt.t) ->
?use_capture:bool -> 'a -> ('b -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tseq_loop (make_event ev) target handler creates a looping Lwt
thread that waits for the event ev to happen on target, then
execute handler, and start again waiting for the event. Events
happening during the execution of the handler are ignored. See
async_loop and buffered_loop for alternative semantics.
For example, the clicks function below is defined by:
let clicks ?use_capture t = seq_loop click ?use_capture t
The thread returned is cancellable using . In order for the loop thread to be canceled from within the handler, the later receives the former as its second parameter.
By default, cancelling the loop will not cancel the potential
currently running handler. This behaviour can be changed by
setting the cancel_handler parameter to true.
val async_loop : (?use_capture:bool -> 'a -> 'b Lwt.t) ->
?use_capture:bool -> 'a -> ('b -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tasync_loop is similar to seq_loop, but each handler runs
independently. No event is thus missed, but since several
instances of the handler can be run concurrently, it is up to the
programmer to ensure that they interact correctly.
Cancelling the loop will not cancel the potential currently running
handlers.
val buffered_loop : ?cancel_handler:bool ->
?cancel_queue:bool ->
(?use_capture:bool -> 'a -> 'b Lwt.t) ->
?use_capture:bool -> 'a -> ('b -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tbuffered_loop is similar to seq_loop, but any event that
occurs during an execution of the handler is queued instead of
being ingnored.
No event is thus missed, but there can be a non predictible delay between its trigger and its treatment. It is thus a good idea to use this loop with handlers whose running time is short, so the memorized event still makes sense when the handler is eventually executed. It is also up to the programmer to ensure that event handlers terminate so the queue will eventually be emptied.
By default, cancelling the loop will not cancel the potential
currently running handler, but any other queued event will be
dropped. This behaviour can be customized using the two optional
parameters cancel_handler and cancel_queue.
val async : (unit -> 'a Lwt.t) -> unitasync t records a thread to be executed later.
It is implemented by calling yield, then Lwt.async.
This is useful if you want to create a new event listener
when you are inside an event handler.
This avoids the current event to be catched by the new event handler
(if it propagates).val click : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.tval dblclick : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.tval mousedown : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.tval mouseup : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.tval mouseover : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.tval mousemove : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.tval mouseout : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.mouseEvent Js.t Lwt.tval keypress : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.keyboardEvent Js.t Lwt.tval keydown : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.keyboardEvent Js.t Lwt.tval keyup : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.keyboardEvent Js.t Lwt.tval input : ?use_capture:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.tval change : ?use_capture:bool -> #Dom_html.eventTarget Js.t -> Dom_html.event Js.t Lwt.tval dragstart : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.tval dragend : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.tval dragenter : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.tval dragover : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.tval dragleave : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.tval drag : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.tval drop : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.dragEvent Js.t Lwt.tval mousewheel : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> (Dom_html.mouseEvent Js.t * (int * int)) Lwt.tval touchstart : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.touchEvent Js.t Lwt.tval touchmove : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.touchEvent Js.t Lwt.tval touchend : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.touchEvent Js.t Lwt.tval touchcancel : ?use_capture:bool ->
#Dom_html.eventTarget Js.t -> Dom_html.touchEvent Js.t Lwt.tval transitionend : #Dom_html.eventTarget Js.t -> unit Lwt.tval clicks : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval dblclicks : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval mousedowns : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval mouseups : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval mouseovers : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval mousemoves : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval mouseouts : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.mouseEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval keypresses : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.keyboardEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval keydowns : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.keyboardEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval keyups : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.keyboardEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval inputs : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval changes : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.event Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval dragstarts : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval dragends : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval dragenters : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval dragovers : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval dragleaves : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval drags : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval drops : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.dragEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval mousewheels : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.mouseEvent Js.t * (int * int) -> unit Lwt.t -> unit Lwt.t) ->
unit Lwt.tval touchstarts : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.touchEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval touchmoves : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.touchEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval touchends : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.touchEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval touchcancels : ?use_capture:bool ->
#Dom_html.eventTarget Js.t ->
(Dom_html.touchEvent Js.t -> unit Lwt.t -> unit Lwt.t) -> unit Lwt.tval request_animation_frame : unit -> unit Lwt.twindow.requestAnimationFrame)