Working Draft
From LocationAware.org
Contents |
Status of the Document
This document is a work in progress. Comments/Feedback/Questions are welcome -- email us at: locationaware-specs(*)locationaware.org.
Todos
- ...
Introduction
Examples of Usage
An example of a single location request with a callback handler
var geolocator = navigator.getGeolocator();
geolocator.request(function(location) {
alert(location.latitude+', '+location.longitude);
});
An example of a single location request with a callback handler
var geolocator = navigator.getGeolocator();
geolocator.onResponse = function(location) {
alert(location.latitude+', '+location.longitude);
}
geolocator.request();
An example of a single location request without a callback handler
var provider = navigator.getGeolocator();
provider.request();
window.setInterval(handleLocation,500,provider);
function handleLocation(provider){
if(provider.status == provider.VALID){
var location = provider.getLocation();
alert(location.latitude+', '+location.longitude);
}else{
alert(provider.error);
}
}
Interfaces
interface Geolocator {
request
onResponse
ERROR
VALID
...
}
interface Geolocation {
latitude
longitude
hpe
}
TODO: define status codes
![[Main Page]](/wiki/skins/common/images/wiki.png)