0.2.2 • Published 7 years ago
@derhuerst/browser-location v0.2.2
browser-location
Get your current location from the Browser, using the geolocation Web API.
See also:
location
for Node.jsisomorphic-location
for Browsers & Node
Help Wanted! Currently, tests are running with Chrome on Windows, but I'd like to extend them to iOS & Android. Contributions welcome!
Installing
npm install @derhuerst/browser-location
Usage
const location = require('@derhuerst/browser-location')
location((err, loc) => {
if (err) console.error(err)
else console.log(loc)
})
This will give you something similar to the following:
{
latitude: 52.547172,
longitude: 13.347745,
precision: 65, // in meters
native: true
}
API
location([timeout], cb)
timeout
is in milliseconds, optional and 10 * 1000
by default. cb(err, loc)
follows the Node callback convention.
Contributing
If you have a question, found a bug or want to propose a feature, have a look at the issues page.