Module Ojw_tools

module Ojw_tools : sig..end

Various utility tools.


Various utility tools.

Size and orientation

type orientation =  | Portrait | Landscape
val get_screen_size : unit -> int * int
val get_screen_orientation : unit -> orientation
val get_size : 
  < clientHeight : < get : int; .. > Js.gen_prop;
   clientWidth : < get : int; .. > Js.gen_prop; .. >
  Js.t -> int * int
val get_document_size : unit -> int * int

Time

val get_timestamp : unit -> float
val as_dom_elt : 
  Dom_html.element Js.t -> (Dom_html.element Js.t -> 'a) -> 'a

as_dom_elt elt f consider elt as an dom element. elt is not visible by the user. Using this function let you retrieve informations which are only available when elt is inserted into the dom.

For example, you can use elt##style inside f to get real width and real heigh of your element elt.

The visibilty css property will be set at hidden during this process.

val closeable : 
  ?get_parent:((#Dom_html.element as 'a) Js.t -> Dom.node Js.t) ->
  ?on_close:(Dom.node Js.t -> unit) -> 'a Js.t -> unit -> unit
val closeable_by_click : 
  ?get_parent:((#Dom_html.element as 'a) Js.t -> Dom.node Js.t) ->
  ?on_close:(Dom.node Js.t -> unit) -> 'a Js.t -> unit