var GeolocationMod = (function(mod){
var mod = mod || {},
watch;
mod.getLocationSuport = function(){
if(navigator.geolocation){
return true;
} else {
console.error('Geolocation não suportado');
return false;;
}
}
mod.getLocation = function(call,deny,conf){
if(mod.getLocationSuport()){
navigator.geolocation.getCurrentPosition(call,deny,conf);
}
};
mod.watchPosition = function(call,deny,conf){
if(mod.getLocationSuport()){
watch = navigator.geolocation.watchPosition(call,deny,conf);
}
};
mod.stopwatchPosition = function(){
if(watch != null && mod.geoLocationSuport()){
navigator.geolocation.clearWatch(watch)
}
};
return mod;
})(GeolocationMod)
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.