Module Brr.Loc

module Loc: sig .. end
Browser location

TODO. Needs redesign/review.

Warning. We use the terminology and return data according to RFC 3986, not according to the broken HTML URLUtils interface.

Location URI

val uri : unit -> Brr.Jstr.t
uri () is the browser's location full URI.
val scheme : unit -> Brr.Jstr.t
scheme () is the scheme of Brr.Loc.uri ().
val host : unit -> Brr.Jstr.t
host () is the host of Brr.Loc.uri ().
val port : unit -> int option
port () is the port of Brr.Loc.uri ().
val path : unit -> Brr.Jstr.t
path () is the path of Brr.Loc.uri ().
val query : unit -> Brr.Jstr.t
query () is the query of Brr.Loc.uri ().
val fragment : unit -> Brr.Jstr.t
fragment () is fragment of Brr.Loc.uri () with the hash.
val set_fragment : Brr.Jstr.t -> unit
set_fragment frag sets the fragment of Brr.Loc.uri () to frag. This does not reload the page but triggers the Brr.Ev.hashchange event.
val update : ?scheme:Brr.Jstr.t ->
?host:Brr.Jstr.t ->
?port:int option ->
?path:Brr.Jstr.t -> ?query:Brr.Jstr.t -> ?fragment:Brr.Jstr.t -> unit -> unit
update ~scheme ~hostname ~port ~path ~query ~fragment () updates the corresponding parts of the location's URI.

Location changes

val hashchange : Brr.Jstr.t Note.event
hashchange occurs whenever the window's fragment changes with the new value of fragment ().
val set : ?replace:bool -> Brr.Jstr.t -> unit
set replace uri sets to browser location to uri, if replace is true the current location is removed from the session history (defaults to false).
val reload : unit -> unit
reload () reloads the current location.