@heycar/heycars-map 0.9.20-timeout3 → 0.9.20-timeout4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -19,7 +19,7 @@ if (typeof GeolocationPositionError === "undefined") {
19
19
  };
20
20
  }
21
21
  const name = "@heycar/heycars-map";
22
- const version = "0.9.20-timeout3";
22
+ const version = "0.9.20-timeout4";
23
23
  const type = "module";
24
24
  const bin = {
25
25
  checkVersion: "./bin/checkVersion.js"
@@ -6835,10 +6835,14 @@ const useAmapGCJ02 = () => {
6835
6835
  async function toGcj02Points(points) {
6836
6836
  await readyPromise;
6837
6837
  return new Promise((resolve) => {
6838
+ let isHandled = false;
6838
6839
  AMap.convertFrom(
6839
- points,
6840
+ [...points],
6840
6841
  "gps",
6841
6842
  (_, result) => {
6843
+ if (isHandled)
6844
+ return;
6845
+ isHandled = true;
6842
6846
  if (result.info === "ok") {
6843
6847
  resolve(result.locations.map(lnglat2point));
6844
6848
  } else {
@@ -6848,6 +6852,9 @@ const useAmapGCJ02 = () => {
6848
6852
  }
6849
6853
  );
6850
6854
  setTimeout(() => {
6855
+ if (isHandled)
6856
+ return;
6857
+ isHandled = true;
6851
6858
  console.warn("警告: 高德坐标转换请求超时,启用本地转换");
6852
6859
  resolve(toLocalGcj02Points(points));
6853
6860
  }, AMAP_TO_GCJ02_TIMEOUT);
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ if (typeof GeolocationPositionError === "undefined") {
17
17
  };
18
18
  }
19
19
  const name = "@heycar/heycars-map";
20
- const version = "0.9.20-timeout3";
20
+ const version = "0.9.20-timeout4";
21
21
  const type = "module";
22
22
  const bin = {
23
23
  checkVersion: "./bin/checkVersion.js"
@@ -6833,10 +6833,14 @@ const useAmapGCJ02 = () => {
6833
6833
  async function toGcj02Points(points) {
6834
6834
  await readyPromise;
6835
6835
  return new Promise((resolve) => {
6836
+ let isHandled = false;
6836
6837
  AMap.convertFrom(
6837
- points,
6838
+ [...points],
6838
6839
  "gps",
6839
6840
  (_, result) => {
6841
+ if (isHandled)
6842
+ return;
6843
+ isHandled = true;
6840
6844
  if (result.info === "ok") {
6841
6845
  resolve(result.locations.map(lnglat2point));
6842
6846
  } else {
@@ -6846,6 +6850,9 @@ const useAmapGCJ02 = () => {
6846
6850
  }
6847
6851
  );
6848
6852
  setTimeout(() => {
6853
+ if (isHandled)
6854
+ return;
6855
+ isHandled = true;
6849
6856
  console.warn("警告: 高德坐标转换请求超时,启用本地转换");
6850
6857
  resolve(toLocalGcj02Points(points));
6851
6858
  }, AMAP_TO_GCJ02_TIMEOUT);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.9.20-timeout3",
3
+ "version": "0.9.20-timeout4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js"