# geo-for-http

> a small tool to getCurrentPosition in http protocol

Latest version **0.0.8** (published 2018-02-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install geo-for-http
pnpm add geo-for-http
yarn add geo-for-http
bun add geo-for-http
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2018-02-11 |
| First published | 2016-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 42.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | zyf394 |
| Maintainers | zyf394 |
| Keywords | geo, getCurrentPosition, location |

## Links

- npm: https://www.npmjs.com/package/geo-for-http
- Repository: https://github.com/zyf394/geo-for-http
- Homepage: https://github.com/zyf394/geo-for-http#readme
- Issues: https://github.com/zyf394/geo-for-http/issues
- npm.io page: https://npm.io/package/geo-for-http

## Dependencies (2)

- [zepto](https://npm.io/package/zepto.md) ^1.0.1
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.6

## Recent versions

- 0.0.8 (latest) — 2018-02-11
- 0.0.6 — 2017-04-20
- 0.0.5 — 2016-12-09
- 0.0.4 — 2016-12-08
- 0.0.3 — 2016-12-07
- 0.0.2 — 2016-12-07
- 0.0.1 — 2016-12-06

## README

a small tool to getCurrentPosition in http protocol
## install
```
npm install geo-for-http
```
## usage 
```javascript
import geo from 'geo-for-http'

// first, use geo.register() to register to the map applicaiton you choose.
geo.register({
  type: 'qq',
  app_key: yourkey,
  app_name: yourappname
});

// then, use geo.getCurrentPosition() to get your current postion.
geo.getCurrentPosition('qq')
  .then( pos => {
    console.log(pos)
  })

```
## API

| API | arguments | type | value | description |
| --- | --- | --- | --- | --- |
| register(arg) |  `arg.type`<br/>`arg.app_key`<br/> `arg.app_name`<br/> | String<br/>String<br/>String |  'qq'(default)/'baidu'/'ali'/'h5'<br/>(your app key) <br/> (your app name)  | Register to the map applicaiton you choose. QQMAP is highly recommended. | 
| getCurrentPosition(mapType, options) |  `mapType`<br/>`options`<br/> | String<br/>Object | 'qq'(default)/'baidu'/'ali'/'h5'<br/>How to set options: [qqmap](http://lbs.qq.com/tool/component-geolocation.html)/[bmap]( http://developer.baidu.com/map/reference/index.php?title=Class:%E6%9C%8D%E5%8A%A1%E7%B1%BB/Geolocation)/[amap](http://lbs.amap.com/api/javascript-api/reference/location/) | Options of each map's original getCurrentPosition function, depends on which map you choose. _You can ignore it at most of the time_. | 
| getCurrentPosition(mapType, options)<br/>.then(pos => {}) |  `pos.lat`<br/>`pos.lng`<br/> `pos.maptype`<br/> | Float<br/>Float<br/>String |  (current postion latitude)<br/>(current postion longitude)<br/>(the map you're using)| Callback function of the `getCurrentPosition()`. |

---
_Source: https://npm.io/package/geo-for-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
