Skip to content

Geolocation

Types

geolocation

An object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location. See WebApiGeolocation on MDN

type geolocation = private {}

geolocationCoordinates

type geolocationCoordinates = private {
accuracy: float,
latitude: float,
longitude: float,
altitude: Null.t<float>,
altitudeAccuracy: Null.t<float>,
heading: Null.t<float>,
speed: Null.t<float>,
}

Record fields

accuracy
float
latitude
float
longitude
float
altitude
Null.t< float >
altitudeAccuracy
Null.t< float >
heading
Null.t< float >
speed
Null.t< float >

geolocationPosition

type geolocationPosition = private {
coords: geolocationCoordinates,
timestamp: int,
}

Record fields

timestamp
int

geolocationPositionError

type geolocationPositionError = {code: int, message: string}

Record fields

code
int
message
string

positionCallback

type positionCallback = geolocationPosition => unit

positionErrorCallback

type positionErrorCallback = geolocationPositionError => unit

positionOptions

type positionOptions = {
mutable enableHighAccuracy?: bool,
mutable timeout?: int,
mutable maximumAge?: int,
}

Record fields

enableHighAccuracy
option< bool >
timeout
option< int >
maximumAge
option< int >