Module Js_of_ocaml.Geolocation

Geolocation API

A code example:

if (Geolocation.is_supported()) then
  let geo = Geolocation.geolocation in
  let options = Geolocation.empty_position_options() in
  let () = options##.enableHighAccuracy := true in
  let f_success pos =
    let coords = pos##.coords in
    let latitude = coords##.latitude in
    Firebug.console##debug latitude ;
  in
  let f_error err =
    let code = err##.code in
    let msg = err##.message in
    if code = err##._TIMEOUT then Firebug.console##debug(msg)
  in
  geo##getCurrentPosition (Js.wrap_callback f_success) (Js.wrap_callback f_error) options
type positionErrorCode
type watchId
class type coordinates = object ... end
class type position = object ... end
class type positionOptions = object ... end
class type positionError = object ... end
class type geolocation = object ... end
val empty_position_options : unit -> positionOptions Js.t
val geolocation : geolocation Js.t
val is_supported : unit -> bool