npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@warpsoft/geolocation

v0.2.49

Published

基于百度地图位置服务的定位插件

Downloads

9

Readme

@warpsoft/geolocation

基于百度地图位置服务的定位插件

Install

npm install @warpsoft/geolocation
npx cap sync

iOS

Apple 需要在Info.plist文件中指定获取位置隐私的描述

  • NSLocationAlwaysUsageDescription (Privacy - Location Always Usage Description)
  • NSLocationWhenInUseUsageDescription (Privacy - Location When In Use Usage Description)

百度地图 需要在Info.plist文件中指定 key

  • BMKLocationKey 2LiwwO3SQoYOSoF1lYwAdpc8TkauXpki

Android

百度地图 需要在 AndroidMenifest.xml 中指定 key

  <application>
    ...
+    <meta-data
+      android:name="com.baidu.lbsapi.API_KEY"
+      android:value="2LiwwO3SQoYOSoF1lYwAdpc8TkauXpki" >
+    </meta-data>
    ...
  </application>

API

getCurrentLocation(...)

getCurrentLocation(options: requestOptions) => Promise<Position>

获取当前位置信息

| Param | Type | Description | | ------------- | --------------------------------------------------------- | ----------- | | options | requestOptions | 请求位置信息的选项 |

Returns: Promise<Position>


watchLocation(...)

watchLocation(options: requestOptions, callback: Function) => Promise<void>

连续获取位置信息

| Param | Type | Description | | -------------- | --------------------------------------------------------- | ----------- | | options | requestOptions | 请求位置信息的选项 | | callback | Function | 处理位置信息的回调函数 |


watchStatus()

watchStatus() => Promise<Status>

获取监视状态

Returns: Promise<Status>


clearWatch()

clearWatch() => Promise<void>

清除位置监视


Interfaces

Position

当前位置信息

| Prop | Type | Description | | ------------ | --------------------------------------------------- | ----------- | | time | string | 获取时间 | | coords | Coordinates | 坐标信息 | | addr | Address | 地址信息 |

Coordinates

地理坐标详细信息

| Prop | Type | Description | | --------------- | ------------------- | ----------- | | latitude | number | 经度 | | longitude | number | 纬度 | | altitude | number | 高度 | | speed | number | 速度 | | direction | number | 方向 | | radius | number | 半径 |

Address

地址中文详细信息

| Prop | Type | Description | | -------------- | ------------------- | ----------- | | country | string | 国家 | | adcode | string | 地区编码 | | province | string | 省 | | city | string | 市 | | district | string | 区 | | street | string | 街道 | | address | string | 地址描述 | | town | string | 村镇 |

requestOptions

请求位置信息的选项

| Prop | Type | Description | | ------------------- | -------------------- | ----------- | | withReGeocode | boolean | 是否携带地址详细信息 |

Function

Creates a new function.

| Prop | Type | | --------------- | --------------------------------------------- | | prototype | any | | length | number | | arguments | any | | caller | Function |

| Method | Signature | Description | | ------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | apply | (this: Function, thisArg: any, argArray?: any) => any | Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. | | call | (this: Function, thisArg: any, ...argArray: any[]) => any | Calls a method of an object, substituting another object for the current object. | | bind | (this: Function, thisArg: any, ...argArray: any[]) => any | For a given function, creates a bound function that has the same body as the original function. The this object of the bound function is associated with the specified object, and has the specified initial parameters. | | toString | () => string | Returns a string representation of a function. |

Status

位置监视状态

| Prop | Type | Description | | -------------- | -------------------- | ---------------------------- | | watching | boolean | 是否正在监视 | | id | string | 监视id 可用来 clearWatch 停止监视位置信息 |