Below is an exmaple of using the location feature.
//Add ready listener
lg.bind('lg_init', init);
function init() {
//Add listener
lg.bind('lg_location', gotResults);
//Get current location
lg.location.getLocation();
}
//An example of getting a continuous update of the location
function startLocation() {
var obj = {};
//How accurate you would like to get the position.
//If using OS 3.0, there are two options, 0 or 5. 0 being high accuracy, 5 being low accuracy.
//If using 2.2.1, you can specify the accuracy in meters, 0 - 100.
//In this example we will use high accuracy
//Optional.
obj.accuracy = 0;
//Used in OS 3.0. Optional.
obj.timeout = obj.timeout;
//Used in OS 3.0 Optional.
obj.maximumAge = obj.maximumAge;
lg.location.start(obj);
}
//An example of stopping a continuous update
function stopLocation() {
lg.location.stop();
}
//Return the result of the location
function gotResults() {
//Get results
console.log(lg.location.latitude);
}
