interface navigator.GeolocationRequest { // Get the current position. // The callback function will be called with the resulting Geolocation // object. void request(PositionCallback callback); // Get the current position, with options! void request(RequestOptions options); // The default level of accuracy that the user has chosen to give about // their location. It takes the same strings as "desiredAccuracy", or null. // This is the highest value of position data that will be given without // prompting the user for permission. readonly string defaultAccuracy; }; interface RequestOptions { // A callback for when everything goes correctly. PositionCallback success; // Optional. // A callback for when bad things happen, it gets a GeoError object. ErrorCallback error; // Optional. // desiredAccuracy can be one of the following strings: // "exact" -- means to give the Geolocation as precisely as possible // "neighborhood" -- means to give the Geolocation good to 1km // "city" -- means to give the Geolocation good to 10km string desiredAccuracy; } interface Geolocation { readonly double latitude; // in degrees readonly double longitude; // in degrees readonly double altitude; // in meters, or null if no data. readonly double accuracy; // in meters readonly double altitudeAccuracy; // in meters, or null if no data int timestamp; // time of the location read, in seconds since // the epoch } interface GeoError { readonly string message; // Human readable error message. // Other attributes can be added as necessary for particular devices. // Only the "message" attribute is guaranteed to be exists. } void PositionCallback(Geolocation position); void ErrorCallback(GeoError error);