Skip to content

Instantly share code, notes, and snippets.

@dewski
Created April 7, 2011 02:16
Show Gist options
  • Save dewski/906900 to your computer and use it in GitHub Desktop.
Save dewski/906900 to your computer and use it in GitHub Desktop.
var location;
var gotPosition = function (currentLocation) {
console.log(location.longitude);
// currentLocation will be the most up to date
// location will always have a value incase, but may not be the most up to date
// process with whatever you need to do, update interface, etc.
}
Titanium.Geolocation.getCurrentPosition(function(e){
Ti.API.info("received geo response");
if (e.error) {
Ti.API.info("ERROR " + e.error);
alert(e.error);
}
location = e.coords;
gotPosition(location);
});
/*
So basically, all I need to do is extract the vars "longitude" and "latitude" out of this function so that I can pass it to another function.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment