提交 789d9718 编写于 作者: D DCloud_LXH

feat: getLocation add isHighAccuracy

上级 d5c2d0da
......@@ -47,6 +47,7 @@ export const getLocation = <API_TYPE_GET_LOCATION>defineAsyncApi(
geocode = false,
altitude = false,
highAccuracyExpireTime,
isHighAccuracy = false,
},
{ resolve, reject }
) => {
......@@ -65,7 +66,7 @@ export const getLocation = <API_TYPE_GET_LOCATION>defineAsyncApi(
},
{
geocode: geocode,
enableHighAccuracy: altitude,
enableHighAccuracy: isHighAccuracy || altitude,
timeout: highAccuracyExpireTime,
}
)
......
......@@ -14,7 +14,10 @@ type GeoRes = (coords: GeolocationCoordinates, skip?: boolean) => void
export const getLocation = <API_TYPE_GET_LOCATION>defineAsyncApi(
API_GET_LOCATION,
({ type, altitude, highAccuracyExpireTime }, { resolve, reject }) => {
(
{ type, altitude, highAccuracyExpireTime, isHighAccuracy },
{ resolve, reject }
) => {
const mapInfo = getMapInfo()
new Promise((resolve: GeoRes, reject) => {
......@@ -23,7 +26,7 @@ export const getLocation = <API_TYPE_GET_LOCATION>defineAsyncApi(
(res) => resolve(res.coords),
reject,
{
enableHighAccuracy: altitude,
enableHighAccuracy: isHighAccuracy || altitude,
timeout: highAccuracyExpireTime || 1000 * 100,
}
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册