0.12.19 • Published 9 years ago

parrot-module-geolocation v0.12.19

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

parrot-module-geolocation

Dependency status Dev Dependencies Status Gittip

Using geolocation with guarantees to obtain a good approximation.

Browser Compatibility

browser support

Install

bower install parrot-module-geolocation --save

Get Started

For use browser geolocation feature we will use parrot.geolocation namespace.

Documentation

parrot.geolocation

.position(Object, <Function>)

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}

.watch(Object, <Function>, <Function>)

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.

.clear(<Integer>)

It simply clear a method handler. You need to provide the uid for do the operation.

License

MIT © ParrotJS