-
-
Save cwilso/3922d0a85a684f8ab298 to your computer and use it in GitHub Desktop.
Rethinking Geolocation in the modern world
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
[NoInterfaceObject] | |
partial interface Navigator { | |
readonly attribute Geolocation geolocation; | |
}; | |
enum GeolocationErrorType { | |
"permission denied", | |
"position unavailable", | |
"timeout" | |
}; | |
[NoInterfaceObject] | |
interface GeolocationError : Error { | |
readonly attribute GeolocationErrorType type; | |
}; | |
[NoInterfaceObject] | |
interface Geolocation { | |
Promise<GeolocationEvent> getCurrentPosition(); | |
Promise startWatchingPosition(); // if resolve(), begins sending ongeoposition or ongeoerror events | |
attribute boolean enableHighAccuracy = false; // Does this actually do anything in practice? | |
[Clamp] attribute unsigned long timeout = 0xFFFFFFFF; | |
[Clamp] attribute unsigned long maximumAge = 0; | |
}; | |
[NoInterfaceObject] | |
interface Coordinates { | |
readonly attribute double latitude; | |
readonly attribute double longitude; | |
readonly attribute double? altitude; | |
readonly attribute double accuracy; | |
readonly attribute double? altitudeAccuracy; | |
readonly attribute double? heading; | |
readonly attribute double? speed; | |
}; | |
[Constructor(DOMString type, optional GeolocationEventInit eventInitDict)] | |
interface GeolocationEvent : Event { | |
readonly attribute Coordinates coords; | |
readonly attribute DOMTimeStamp timestamp; // DOMHighResTimeStamp? | |
}; | |
dictionary GeolocationEventInit { | |
Coordinates coords; | |
DOMTimeStamp timestamp; // DOMHighResTimeStamp? | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment