Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derhuerst/isomorphic-location
Get your current location in Node & Browser.
https://github.com/derhuerst/isomorphic-location
geolocation gps isomorphic location
Last synced: 6 days ago
JSON representation
Get your current location in Node & Browser.
- Host: GitHub
- URL: https://github.com/derhuerst/isomorphic-location
- Owner: derhuerst
- License: isc
- Created: 2016-09-08T23:59:20.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-25T20:00:33.000Z (over 6 years ago)
- Last Synced: 2024-10-03T23:56:19.088Z (about 1 month ago)
- Topics: geolocation, gps, isomorphic, location
- Language: JavaScript
- Homepage: https://github.com/derhuerst/isomorphic-location
- Size: 9.77 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# *isomorphic-location*
**Get your current location in Node & Browser**, using [`location`](https://github.com/derhuerst/location) in Node and [`browser-location`](https://github.com/derhuerst/browser-location) in the browser.
[![npm version](https://img.shields.io/npm/v/isomorphic-location.svg)](https://www.npmjs.com/package/isomorphic-location)
[![build status](https://img.shields.io/travis/derhuerst/isomorphic-location.svg)](https://travis-ci.org/derhuerst/isomorphic-location)
[![dependency status](https://img.shields.io/david/derhuerst/isomorphic-location.svg)](https://david-dm.org/derhuerst/isomorphic-location)
[![dev dependency status](https://img.shields.io/david/dev/derhuerst/isomorphic-location.svg)](https://david-dm.org/derhuerst/isomorphic-location#info=devDependencies)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/isomorphic-location.svg)
[![chat on gitter](https://badges.gitter.im/derhuerst.svg)](https://gitter.im/derhuerst)
[![support me on Patreon](https://img.shields.io/badge/support%20me-on%20patreon-fa7664.svg)](https://patreon.com/derhuerst)## Installing
```shell
npm install isomorphic-location
```## Usage
```js
const location = require('isomorphic-location')location((err, loc) => {
if (err) console.error(err)
else console.log(loc)
})
```This will give you something similar to the following:
```js
{
latitude: 52.547172,
longitude: 13.347745,
precision: 65, // in meters
native: true
}
```## API
```js
location([timeout], cb)
````timeout` is in milliseconds, optional and `10 * 1000` by default. `cb(err, loc)` follows the [Node callback convention](https://stackoverflow.com/a/40512067).
## Contributing
If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/location/issues).