Using geolocation with guarantees to obtain a good approximation.
bower install parrot-module-geolocation --save
For use browser geolocation
feature we will use parrot.geolocation
namespace.
Use this method to get your current position.
The method return a callback with Position
Object or Error
.
Also yo can provide a specific options. default options are:
enableHighAccuracy : true # precision first
maximumAge : 0 # not cache
timeout : 600 # 10s timeout
And example of use:
parrot.geolocation.position (position, err) ->
return error if err?
position
# => {accuracy:848, latitude:37, longitude:-1, timestamp:1418986533158}
It registers a method handler that will be called when the position changed.
And again you can provide your options, but the default options are:
enableHighAccuracy : false # not necessary precision
timeout : 600 # 10s timeout
maximumAge : 0 # not cache
This method return a uid
that you need to store for clear the handler later.
It simply clear a method handler. You need to provide the uid
for do the operation.
MIT © ParrotJS