package js_of_ocaml

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Js_of_ocaml.GeolocationSource

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
    Console.console##debug latitude ;
  in
  let f_error err =
    let code = err##.code in
    let msg = err##.message in
    if code = err##._TIMEOUT then Console.console##debug(msg)
  in
  geo##getCurrentPosition (Js.wrap_callback f_success) (Js.wrap_callback f_error) options
Sourcetype positionErrorCode
Sourcetype watchId
Sourceclass type coordinates = object ... end
Sourceclass type position = object ... end
Sourceclass type positionOptions = object ... end
Sourceclass type positionError = object ... end
Sourceclass type geolocation = object ... end
Sourceval empty_position_options : unit -> positionOptions Js.t
Sourceval geolocation : geolocation Js.t
Sourceval is_supported : unit -> bool
OCaml

Innovation. Community. Security.