123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105moduletypeS=sig(** Subscriptions to global events. *)typetimetype_decoder(** {1 Basics} *)type'mtvalnone:'mtvalbatch:'mtlist->'mtvalmap:('a->'b)->'at->'bt(** {1 Events on the window object} *)valon_window:string->'mdecoder->'mt(** [on_window event_type decode]
Subscribe to window events of type [event_type]. Examples
{[
on_window "resize" decode
on_window "keydown" decode
]}
*)(** {1 Incoming messages from javascript} *)valon_message:'mdecoder->'mt(** [on_message decode]
Subscribe to incoming messages from the javascript world. If there is an
incoming message (a javascript object) then decode the object with the
help of the function [decode] and send the decoded value as a message to
the update function of the application.
*)(** {1 Timer events} *)valevery:int->(time->'m)->'mt(** [every millis f] Subscribe to an event which is fired every [millis]
milliseconds. Use [f] to map the posix time into a message for the
update function. *)valon_animation:(time->'m)->'mt(** [on_animation f]
Subscribe to the [requestAnimationFrame] event. The callback gets the
posix time at the event.
*)(** {1 Keyboard events} *)valon_keydown:(string->'m)->'mtvalon_keyup:(string->'m)->'mt(** {1 Mouse events} *)(** The following mouse event subscriptions just decode the [clientX] and
[clientY] value of the mouse event. But a mouse event has much more
information. You can get a customized subscription which decodes more
mouse event data by just writing a decoder [decode] which decodes all
values from a mouse event which are of interest and subscribe to the
mouse event e.g. by [on_window "mouseup" decode]. *)valon_mouse_down:(int->int->'m)->'mt(** Subscribe to mousedown events. *)valon_mouse_move:(int->int->'m)->'mt(** Subscribe to mousemove events. *)valon_mouse_up:(int->int->'m)->'mt(** Subscribe to mouseup events. *)(** {1 Window resize} *)valon_resize:(int->int->'m)->'mt(** [on_resize f] Subscribe to the window resize event and report the
[innerWidth] and [innerHeight] properties to the function [f] to generate
the message for the update function. *)(** {1 Visibility change} *)valon_visibility_change:(string->'m)->'mt(** [on_visibility_change f] Subscribe to the window visibility
change event and report the visibility state which is either "visible"
or "hidden" to the function [f] to generate the message for the update
function. *)end