0.0.8 • Published 6 years ago

geo-for-http v0.0.8

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

a small tool to getCurrentPosition in http protocol

install

npm install geo-for-http

usage

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

APIargumentstypevaluedescription
register(arg)arg.typearg.app_key arg.app_nameStringStringString'qq'(default)/'baidu'/'ali'/'h5'(your app key) (your app name)Register to the map applicaiton you choose. QQMAP is highly recommended.
getCurrentPosition(mapType, options)mapTypeoptionsStringObject'qq'(default)/'baidu'/'ali'/'h5'How to set options: qqmap/bmap/amapOptions 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).then(pos => {})pos.latpos.lng pos.maptypeFloatFloatString(current postion latitude)(current postion longitude)(the map you're using)Callback function of the getCurrentPosition().
0.0.8

6 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago