Created
December 3, 2022 17:12
-
-
Save dellisd/ce3b8376d911fc7f0a148ceb6a13a24a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
external class GeolocationCoordinates { | |
val latitude: Double | |
val longitude: Double | |
val altitutde: Double | |
val accuracy: Double | |
val altitudeAccuracy: Double | |
val heading: Double | |
val speed: Double | |
} | |
external class GeolocationPosition { | |
val coords: GeolocationCoordinates | |
val timestamp: Double | |
} | |
external class GeolocationPositionError { | |
val code: Int | |
val message: String | |
} | |
external class GeolocationOptions { | |
val maximumAge: Int | |
val timeout: Int | |
val enableHighAccuracy: Boolean | |
} | |
external class Geolocation { | |
fun getCurrentPosition(success: (GeolocationCoordinates) -> Unit, error: (GeolocationPositionError) -> Unit = {}, options: GeolocationOptions? = null) | |
fun watchPosition(success: (GeolocationCoordinates) -> Unit, error: (GeolocationPositionError) -> Unit = {}, options: GeolocationOptions? = null): Int | |
fun clearWatch(id: Int) | |
} | |
val Navigator.geolocation get() = js("window.navigator.geolocation").unsafeCast<Geolocation>() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment