Module Dom.Window

Module representing a browser window.

Use this module only in code executing within a browswer window. Don't use it in node and not in a web worker either.

The window object is an event target for the following events and many more which can propagate from inner elements.

type t
val get : unit -> t

Get the window object.

val event_target : t -> Event_target.t

The window as an event target.

val document : t -> Document.t

The document of the window.

val history : t -> History.t

Browser history.

val location : t -> Location.t

Location object.

val on_next_animation : (float -> unit) -> t -> unit

on_next_animation callback window

The callback is called on the next animation frame. Usually a browser has 60 frames per second.

The argument received by the callback is the time in milliseconds since the current document has been loaded.