MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / createMapboxAdapter

Function createMapboxAdapter

packages/core/src/runtime/adapters/mapbox.ts:9–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7
8// 'load' = style + sources ready (not tile-level 'idle'); sufficient for render-ready gate
9export function createMapboxAdapter() {
10 return createReadinessAdapter<MapboxMapLike>({
11 name: "mapbox",
12 getInstances: () => {
13 if (typeof window === "undefined") return [];
14 const arr = (window as { __hfMapbox?: MapboxMapLike[] }).__hfMapbox;
15 return Array.isArray(arr) ? arr : [];
16 },
17 waitFor: (m) =>
18 new Promise<void>((resolve) => {
19 if (m.loaded()) {
20 resolve();
21 return;
22 }
23 m.on("load", resolve);
24 }),
25 });
26}

Callers 2

mapbox.test.tsFile · 0.90

Calls 3

createReadinessAdapterFunction · 0.90
resolveFunction · 0.85
onMethod · 0.65

Tested by

no test coverage detected