Skip to content

Instantly share code, notes, and snippets.

@cwilso
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwilso/3922d0a85a684f8ab298 to your computer and use it in GitHub Desktop.
Save cwilso/3922d0a85a684f8ab298 to your computer and use it in GitHub Desktop.
Rethinking Geolocation in the modern world
[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