Module Window.History
Browser history.
module Scroll_restoration : sig ... endThe scroll restoration enum.
The type for History objects. See Window.history to get one.
val length : Brr.Window.History.t -> intlength h is the number of elements in history including the currently loaded page.
val scroll_restoration :
Brr.Window.History.t ->
Brr.Window.History.Scroll_restoration.tscroll_restoration h is the scroll restoration behaviour of h.
val set_scroll_restoration :
Brr.Window.History.t ->
Brr.Window.History.Scroll_restoration.t ->
unitset_scroll_restoration h r sets the scroll_restoration of h to r.
Moving in history
val back : Brr.Window.History.t -> unitback h goes back in history.
val forward : Brr.Window.History.t -> unitforward h goes forward in history.
val go : Brr.Window.History.t -> int -> unitgo 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.tThe type for history state.
val state : Brr.Window.History.t -> Jv.tval push_state :
?state:Brr.Window.History.state ->
?title:Jstr.t ->
?uri:Brr.Uri.t ->
Brr.Window.History.t ->
unitpush_state h ~state ~title ~uri h pushes state state with title title and URI uri (if any). Any of these can be omitted.
Warning. The title argument seems to be ignored by browsers. Use Document.set_title to change the title.
val replace_state :
?state:Brr.Window.History.state ->
?title:Jstr.t ->
?uri:Brr.Uri.t ->
Brr.Window.History.t ->
unitreplace_state h ~state ~title ~uri replaces state state with title title and URI uri (if any). Any of these can be omitted.
Warning. The title argument seems to be ignored by browsers. Use Document.set_title to change the title.
Events
module Ev : sig ... endHistory events.
val to_jv : Brr.Window.History.t -> Jv.jvval of_jv : Jv.jv -> Brr.Window.History.t