Module Brr.Window

Window objects.

Some of the objects and methods that are accessed from Window objects are in other modules:

type t = El.window

The type for Window objects. See G.window for the global window object.

val as_target : t ->

as_target w is the window as an event target.

val closed : t -> bool

closed w is true if w is closed.

val scroll_x : t -> float

scroll_x w is the number of (sub)pixels the window is horizontally scrolled by.

val scroll_y : t -> float

scroll_y w is the number of (sub)pixels the window is vertically scrolled by.

Media properties

val device_pixel_ratio : t -> float

device_pixel_ratio w is the ratio between physical and CSS pixels. A value of 2. indicates that two physical pixels are used to draw a single CSS pixel.

val matches_media : t -> Jstr.t -> bool

matches_media w mq is true if the media query mq matches. See Window.matchMedia.

val prefers_dark_color_scheme : t -> bool

prefers_dark_scheme w is true if the "(prefers-color-scheme: dark)" media query matches.


val close : t -> unit

close w closes window w.

val print : t -> unit

print w opens the print dialog to print the window document.

val reload : t -> unit

reload w reloads w (on its location property).

Location and history

val location : t -> Uri.t

location w is the window's location.

Note we do not bind the Location object, everything you need can be done with Uri, set_location, reload and possibly History.

val set_location : t -> Uri.t -> unit

set_location w l sets the window location to l.

module History : sig ... end

Browser history.

val history : t -> History.t

history w is the history of w.