Skip to content

ui/map/rendering/styleReady

Functions

isStyleReady()

function isStyleReady(map): boolean;

Defined in: ui/map/rendering/styleReady.ts:15

True once the map's style document is parsed, which is all map.addLayer() needs.

Deliberately not map.isStyleLoaded(): that also waits for every source to finish loading, and each aircraft data tick puts the GeoJSON traffic sources back into "loading" for a moment. With traffic streaming on a slow renderer (a few frames per second) a per-frame poll of isStyleLoaded() can keep missing the brief loaded window, so a layer waiting on it attaches late or never. getStyle() returns undefined exactly while the style document itself is still loading.

Parameters

map

Map$1

Returns

boolean


whenStyleReady()

function whenStyleReady(
   map, 
   isCurrent, 
   callback
): void;

Defined in: ui/map/rendering/styleReady.ts:28

Run callback once the map style is ready for addLayer (polled per animation frame, since style.load may already have fired).

Parameters

map

Map$1

Map whose style to wait for.

isCurrent

() => boolean

Checked before every poll; return false to abandon the wait (owner destroyed, or moved to another map).

callback

() => void

Invoked once, on the first frame the style is ready.

Returns

void