export interface Params { inverseEnabled?: boolean; locationMode?: 0 | 1; } export interface Data { longitude: number; latitude: number; horizontalAccuracy: number; formattedAddress?: string; country?: string; province?: string; city?: string; citycode?: string; district?: string; adcode?: string; street?: string; number?: string; POIName?: string; AOIName?: string; } /** * return * @typedef Data * @property {number} longitude - 经度 * @property {number} latitude - 纬度 * @property {number} horizontalAccuracy - 水平精确度, 单位:m * @property {string} formattedAddress - 格式化地址 (需要inverseEnabled=true) * @property {string} country - 国家 (需要inverseEnabled=true) * @property {string} province - 省/直辖市 (需要inverseEnabled=true) * @property {string} city - 市 (需要inverseEnabled=true) * @property {string} citycode - 城市编码 (需要inverseEnabled=true) * @property {string} district - 区/县 (需要inverseEnabled=true) * @property {string} adcode - 区域编码 (需要inverseEnabled=true) * @property {string} street - 街道名称 (需要inverseEnabled=true) * @property {string} number - 门牌号 (需要inverseEnabled=true) * @property {string} POIName - 兴趣点名称 (需要inverseEnabled=true) * @property {string} AOIName - 兴趣面名称 (需要inverseEnabled=true) */ /** * * @name getLocation * @title 获取位置 * @param {boolean} [inverseEnabled=false] - 开启逆地理编码, 以获取更多格式化信息. 注: 获取逆地理信息需要联网 * @param {number} [locationMode=0] - 使用的定位类型 0 :NETWORK_PROVIDER 1 :GPS_PROVIDER 注:不传默认使用网络进行定位,gps定位可能无法在室内使用 * @return {string} code - 200:成功 | 404:失败 * @return {string} msg - 响应信息 * @return {Data} data - 响应数据 * @fragment featch(params: any) { const { inverseEnabled, locationMode } = params return suplink.getLocation({ inverseEnabled: inverseEnabled === 'true', locationMode: locationMode, }) } * @example * import { getLocation } from '@suplink/jssdk'; * * getLocation().then((res) => console.log(res)) */ export default function getLocation(params: Params): Promise>;