MCPcopy Create free account
hub / github.com/ImGoodBai/MapGoGoGo / loadAmap

Function loadAmap

frontend/src/maps.tsx:55–71  ·  view source on GitHub ↗
(config: AppConfig | null, plugins: string[] = [])

Source from the content-addressed store, hash-verified

53let amapPromise: Promise<any> | null = null;
54
55export function loadAmap(config: AppConfig | null, plugins: string[] = []) {
56 if (!config?.has_amap) {
57 return Promise.reject(new Error("高德 Key 未配置"));
58 }
59 window._AMapSecurityConfig = {
60 securityJsCode: config.amap_security_code,
61 };
62 const existing = new Set<string>((window as any).__mapgameAmapPlugins || []);
63 const mergedPlugins = Array.from(new Set([...existing, ...plugins]));
64 amapPromise = AMapLoader.load({
65 key: config.amap_key,
66 version: "2.0",
67 plugins: mergedPlugins,
68 });
69 (window as any).__mapgameAmapPlugins = mergedPlugins;
70 return amapPromise;
71}
72
73function bounds(cells: ChallengeCell[]) {
74 if (cells.length === 0) return null;

Callers 2

searchPlacesFunction · 0.90
AmapViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected