Skip to content

Instantly share code, notes, and snippets.

@ootes
Created November 26, 2012 15:10
Show Gist options
  • Save ootes/4148703 to your computer and use it in GitHub Desktop.
Save ootes/4148703 to your computer and use it in GitHub Desktop.
Geolocatie script
// Variable declaration
var SANDBOX = "SANDBOX";
var LINEAIR = "LINEAIR";
var GPS_AVAILABLE = 'GPS_AVAILABLE';
var GPS_UNAVAILABLE = 'GPS_UNAVAILABLE';
var POSITION_UPDATED = 'POSITION_UPDATED';
var REFRESH_RATE = 1000;
var currentPosition = currentPositionMarker = customDebugging = debugId = map = interval =intervalCounter = updateMap = false;
var locatieRij = markerRij = [];
var map = {
generate: function(){
}
};
var location = {
init: function(){
debug.message("Controleer of GPS beschikbaar is...");
ET.addListener(GPS_AVAILABLE, this.startInterval);
ET.addListener(GPS_UNAVAILABLE, function(){debug.message('GPS is niet beschikbaar.')});
(geo_position_js.init())?ET.fire(GPS_AVAILABLE):ET.fire(GPS_UNAVAILABLE);
},
startInterval: function(event){
debug.message("GPS is beschikbaar, vraag positie.");
this.update_position();
interval = setInterval(this.updatePosition, REFRESH_RATE);
ET.addListener(POSITION_UPDATED, this.checkLocations);
},
updatePosition: function(){
},
checkLocations: function(){
}
};
var debug = {
message: function(){
// error handling
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment