@heycar/heycars-map 2.3.0-drag2 → 2.3.0-drag3
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/v2/chunks/throttle.8bdd8d3b.js +20 -0
- package/dist/v2/hooks/useDeviceOrientation.js +1 -17
- package/dist/v2/hooks/useMapLoader.js +11 -4
- package/dist/v2/utils/log.js +1 -1
- package/dist/v3/chunks/throttle.8bdd8d3b.js +20 -0
- package/dist/v3/hooks/useDeviceOrientation.js +1 -17
- package/dist/v3/hooks/useMapLoader.js +11 -4
- package/dist/v3/utils/log.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { i as isObject, d as debounce } from "./debounce.5afe7867.js";
|
|
2
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
3
|
+
function throttle(func, wait, options) {
|
|
4
|
+
var leading = true, trailing = true;
|
|
5
|
+
if (typeof func != "function") {
|
|
6
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
7
|
+
}
|
|
8
|
+
if (isObject(options)) {
|
|
9
|
+
leading = "leading" in options ? !!options.leading : leading;
|
|
10
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
11
|
+
}
|
|
12
|
+
return debounce(func, wait, {
|
|
13
|
+
"leading": leading,
|
|
14
|
+
"maxWait": wait,
|
|
15
|
+
"trailing": trailing
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
throttle as t
|
|
20
|
+
};
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import { reactive, watch } from "vue-demi";
|
|
2
2
|
import { MINI_PROGRAM_WEB_VIEW_CLOSE_EVENT } from "../utils/patchMiniprogram.js";
|
|
3
3
|
import { OS_PLATFORM, detectOSPlatform } from "../utils/platform.js";
|
|
4
|
-
import {
|
|
5
|
-
var FUNC_ERROR_TEXT = "Expected a function";
|
|
6
|
-
function throttle(func, wait, options) {
|
|
7
|
-
var leading = true, trailing = true;
|
|
8
|
-
if (typeof func != "function") {
|
|
9
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
10
|
-
}
|
|
11
|
-
if (isObject(options)) {
|
|
12
|
-
leading = "leading" in options ? !!options.leading : leading;
|
|
13
|
-
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
14
|
-
}
|
|
15
|
-
return debounce(func, wait, {
|
|
16
|
-
"leading": leading,
|
|
17
|
-
"maxWait": wait,
|
|
18
|
-
"trailing": trailing
|
|
19
|
-
});
|
|
20
|
-
}
|
|
4
|
+
import { t as throttle } from "../chunks/throttle.8bdd8d3b.js";
|
|
21
5
|
const DEVICE_ORIENTATION_INTERVAL = 200;
|
|
22
6
|
const CSS_DEVICE_ORIENTATION_VAR_PREFIX = "--CSS_DEVICE_ORIENTATION_VAR_ROTATION_DEGREE_";
|
|
23
7
|
const useDeviceOrientation = (props) => {
|
|
@@ -4,6 +4,7 @@ import { MANUAL_ABORT_MESSAGE } from "../utils/ManualAbortError.js";
|
|
|
4
4
|
import { watchPostEffectForDeepOption } from "../utils/compare.js";
|
|
5
5
|
import { createOneConcurrent, sleep, createRunOnce } from "../utils/helper.js";
|
|
6
6
|
import { patchGoogleMapLoader } from "../utils/patchGoogleMapLoader.js";
|
|
7
|
+
import { t as throttle } from "../chunks/throttle.8bdd8d3b.js";
|
|
7
8
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
8
9
|
function adopt(value) {
|
|
9
10
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -548,6 +549,7 @@ var dist = {
|
|
|
548
549
|
});
|
|
549
550
|
})(dist);
|
|
550
551
|
const MIN_MAP_RELOAD_INTERVAL = 5e3;
|
|
552
|
+
const MIN_GMAP_LOAD_RESET_THRESHOLD = 1e3;
|
|
551
553
|
const DEFAULT_AMAP_PLUGINS = [
|
|
552
554
|
"AMap.Geocoder",
|
|
553
555
|
"AMap.Driving",
|
|
@@ -649,6 +651,9 @@ const useAmapLoader = (props) => {
|
|
|
649
651
|
watchPostEffectForDeepOption(() => [optionsRef.value, disableRef == null ? void 0 : disableRef.value], keepRetry);
|
|
650
652
|
return { statusRef, pingStatusRef, readyPromise };
|
|
651
653
|
};
|
|
654
|
+
const throttledExecute = throttle((fn) => fn(), MIN_GMAP_LOAD_RESET_THRESHOLD, {
|
|
655
|
+
trailing: false
|
|
656
|
+
});
|
|
652
657
|
const useGmapLoader = (props) => {
|
|
653
658
|
const { disableRef, onSuccess, onFail, onDownloadOptimizeEnd } = props;
|
|
654
659
|
let resolveLoader;
|
|
@@ -670,10 +675,12 @@ const useGmapLoader = (props) => {
|
|
|
670
675
|
return Promise.resolve();
|
|
671
676
|
const loader = new Loader({ ...options, retries: 0 });
|
|
672
677
|
patchGoogleMapLoader(loader);
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
678
|
+
throttledExecute(() => {
|
|
679
|
+
if (loader.status !== LoaderStatus.INITIALIZED) {
|
|
680
|
+
window.google = void 0;
|
|
681
|
+
loader.reset();
|
|
682
|
+
}
|
|
683
|
+
});
|
|
677
684
|
const abortPromise = new Promise((resolve) => signal == null ? void 0 : signal.addEventListener("abort", resolve));
|
|
678
685
|
statusRef.value = "LOADING";
|
|
679
686
|
const startTime = Date.now();
|
package/dist/v2/utils/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const availableLogKeys = /* @__PURE__ */ new Set();
|
|
2
2
|
const pkgName = "@heycar/heycars-map";
|
|
3
|
-
const pkgVersion = "2.3.0-
|
|
3
|
+
const pkgVersion = "2.3.0-drag3";
|
|
4
4
|
const isEnableLog = (name) => {
|
|
5
5
|
const searchParam = new URLSearchParams(location.search);
|
|
6
6
|
return searchParam.has(`log-${name}`);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { i as isObject, d as debounce } from "./debounce.5afe7867.js";
|
|
2
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
3
|
+
function throttle(func, wait, options) {
|
|
4
|
+
var leading = true, trailing = true;
|
|
5
|
+
if (typeof func != "function") {
|
|
6
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
7
|
+
}
|
|
8
|
+
if (isObject(options)) {
|
|
9
|
+
leading = "leading" in options ? !!options.leading : leading;
|
|
10
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
11
|
+
}
|
|
12
|
+
return debounce(func, wait, {
|
|
13
|
+
"leading": leading,
|
|
14
|
+
"maxWait": wait,
|
|
15
|
+
"trailing": trailing
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
throttle as t
|
|
20
|
+
};
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import { reactive, watch } from "vue-demi";
|
|
2
2
|
import { MINI_PROGRAM_WEB_VIEW_CLOSE_EVENT } from "../utils/patchMiniprogram.js";
|
|
3
3
|
import { OS_PLATFORM, detectOSPlatform } from "../utils/platform.js";
|
|
4
|
-
import {
|
|
5
|
-
var FUNC_ERROR_TEXT = "Expected a function";
|
|
6
|
-
function throttle(func, wait, options) {
|
|
7
|
-
var leading = true, trailing = true;
|
|
8
|
-
if (typeof func != "function") {
|
|
9
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
10
|
-
}
|
|
11
|
-
if (isObject(options)) {
|
|
12
|
-
leading = "leading" in options ? !!options.leading : leading;
|
|
13
|
-
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
14
|
-
}
|
|
15
|
-
return debounce(func, wait, {
|
|
16
|
-
"leading": leading,
|
|
17
|
-
"maxWait": wait,
|
|
18
|
-
"trailing": trailing
|
|
19
|
-
});
|
|
20
|
-
}
|
|
4
|
+
import { t as throttle } from "../chunks/throttle.8bdd8d3b.js";
|
|
21
5
|
const DEVICE_ORIENTATION_INTERVAL = 200;
|
|
22
6
|
const CSS_DEVICE_ORIENTATION_VAR_PREFIX = "--CSS_DEVICE_ORIENTATION_VAR_ROTATION_DEGREE_";
|
|
23
7
|
const useDeviceOrientation = (props) => {
|
|
@@ -4,6 +4,7 @@ import { MANUAL_ABORT_MESSAGE } from "../utils/ManualAbortError.js";
|
|
|
4
4
|
import { watchPostEffectForDeepOption } from "../utils/compare.js";
|
|
5
5
|
import { createOneConcurrent, sleep, createRunOnce } from "../utils/helper.js";
|
|
6
6
|
import { patchGoogleMapLoader } from "../utils/patchGoogleMapLoader.js";
|
|
7
|
+
import { t as throttle } from "../chunks/throttle.8bdd8d3b.js";
|
|
7
8
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
8
9
|
function adopt(value) {
|
|
9
10
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -548,6 +549,7 @@ var dist = {
|
|
|
548
549
|
});
|
|
549
550
|
})(dist);
|
|
550
551
|
const MIN_MAP_RELOAD_INTERVAL = 5e3;
|
|
552
|
+
const MIN_GMAP_LOAD_RESET_THRESHOLD = 1e3;
|
|
551
553
|
const DEFAULT_AMAP_PLUGINS = [
|
|
552
554
|
"AMap.Geocoder",
|
|
553
555
|
"AMap.Driving",
|
|
@@ -649,6 +651,9 @@ const useAmapLoader = (props) => {
|
|
|
649
651
|
watchPostEffectForDeepOption(() => [optionsRef.value, disableRef == null ? void 0 : disableRef.value], keepRetry);
|
|
650
652
|
return { statusRef, pingStatusRef, readyPromise };
|
|
651
653
|
};
|
|
654
|
+
const throttledExecute = throttle((fn) => fn(), MIN_GMAP_LOAD_RESET_THRESHOLD, {
|
|
655
|
+
trailing: false
|
|
656
|
+
});
|
|
652
657
|
const useGmapLoader = (props) => {
|
|
653
658
|
const { disableRef, onSuccess, onFail, onDownloadOptimizeEnd } = props;
|
|
654
659
|
let resolveLoader;
|
|
@@ -670,10 +675,12 @@ const useGmapLoader = (props) => {
|
|
|
670
675
|
return Promise.resolve();
|
|
671
676
|
const loader = new Loader({ ...options, retries: 0 });
|
|
672
677
|
patchGoogleMapLoader(loader);
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
678
|
+
throttledExecute(() => {
|
|
679
|
+
if (loader.status !== LoaderStatus.INITIALIZED) {
|
|
680
|
+
window.google = void 0;
|
|
681
|
+
loader.reset();
|
|
682
|
+
}
|
|
683
|
+
});
|
|
677
684
|
const abortPromise = new Promise((resolve) => signal == null ? void 0 : signal.addEventListener("abort", resolve));
|
|
678
685
|
statusRef.value = "LOADING";
|
|
679
686
|
const startTime = Date.now();
|
package/dist/v3/utils/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const availableLogKeys = /* @__PURE__ */ new Set();
|
|
2
2
|
const pkgName = "@heycar/heycars-map";
|
|
3
|
-
const pkgVersion = "2.3.0-
|
|
3
|
+
const pkgVersion = "2.3.0-drag3";
|
|
4
4
|
const isEnableLog = (name) => {
|
|
5
5
|
const searchParam = new URLSearchParams(location.search);
|
|
6
6
|
return searchParam.has(`log-${name}`);
|