= 1024" x-on:close-sidebar="sidebar=window.innerWidth >= 1024 && true">
package js_of_ocaml
-
js_of_ocaml
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
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
- see https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
for API documentation.
- see http://www.w3.org/TR/geolocation-API/
for the W3C Recommendation.
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