package brr

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Browser history.

module Scroll_restoration : sig ... end

The scroll restoration enum.

type t

The type for History objects. See Window.history to get one.

val length : t -> int

length h is the number of elements in history including the currently loaded page.

val scroll_restoration : t -> Scroll_restoration.t

scroll_restoration h is the scroll restoration behaviour of h.

val set_scroll_restoration : t -> Scroll_restoration.t -> unit

set_scroll_restoration h r sets the scroll_restoration of h to r.

Moving in history

val back : t -> unit

back h goes back in history.

val forward : t -> unit

forward h goes forward in history.

val go : t -> int -> unit

go delta goes forward or backward in history by delta steps. 0 reloads the current page.

Making history

Warning. This may become typed in the future. Note that the specifiation mandates state values to be serializable.

type state = Jv.t

The type for history state.

val state : t -> Jv.t

state h is the state at the top of the history stack. Warning. This can be Jv.null

val push_state : ?state:state -> ?title:Jstr.t -> ?uri:Uri.t -> t -> unit

push_state h ~state ~title ~uri h pushes state state with title title and URI uri (if any). Any of these can be omitted.

val replace_state : ?state:state -> ?title:Jstr.t -> ?uri:Uri.t -> t -> unit

replace_state h ~state ~title ~uri replaces state state with title title and URI uri (if any). Any of these can be omitted.

Events

module Ev : sig ... end

History events.

OCaml

Innovation. Community. Security.