Module Brr_io.Geolocation

Access to device location.

See Geolocation API.

module Error : sig ... end

Position errors.

module Pos : sig ... end


type opts

The type for geolocalisation options.

val opts : ?⁠high_accuracy:bool -> ?⁠timeout_ms:int -> ?⁠maximum_age_ms:int -> unit -> opts

opts ~high_accuracy ~maximum_age_ms ~timeout_ms () are geolocalisation options.


type t

The type for device Geolocation objects.

val of_navigator : Brr.Navigator.t -> t

of_navigator n is a device geolocalisation object for navigator n.

val get : ?⁠opts:opts -> t -> (Pos.tError.t) Fut.result

get l ~opts is the position of l determined with options opts.

type watch_id = int

The type for watcher identifiers.

val watch : ?⁠opts:opts -> t -> ((Pos.tError.t) Stdlib.result -> unit) -> watch_id

watch l ~opts f monitors the position of l determined with opts by periodically calling f. Stop watching by calling unwatch with the returned identifier.

val unwatch : t -> watch_id -> unit

unwatch l id unwatches id as returned by a previous call to watch.