- Geolocation API for the browser. Works only over HTTPS (not localhost).
- https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API
- https://caniuse.com/geolocation
Types
GeolocationCoordinates = ref object of JsRoot latitude*, longitude*, altitude*, accuracy*, altitudeAccuracy*, heading*, speed*: SomeNumber
- https://developer.mozilla.org/en-US/docs/Web/API/GeolocationCoordinates
GeolocationPosition = ref object of JsRoot coords*: GeolocationCoordinates
- https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPosition
Procs
func clearWatch(id: SomeNumber) {.importjs: "(navigator.geolocation.$1(#))", discardable, ...raises: [], tags: [].}
func getCurrentPosition[T](success, error: T) {. importjs: "(navigator.geolocation.$1(#, #))", discardable, ...raises: [], tags: [].}
func getCurrentPosition[T](success, error: T; maximumAge, timeout: SomeNumber; enableHighAccuracy: bool) {.importjs: "(navigator.geolocation.$1(#, #, {maximumAge: #, timeout: #, enableHighAccuracy: #}))", discardable, ...raises: [], tags: [].}
func getCurrentPosition[T](success: T) {. importjs: "(navigator.geolocation.$1(#))", discardable, ...raises: [], tags: [].}
func hasGeolocation(): bool {.importjs: "(\'geolocation\' in navigator)@", ...raises: [], tags: [].}