MCPcopy Create free account
hub / github.com/visgl/react-map-gl / createLayer

Function createLayer

modules/react-mapbox/src/components/layer.ts:70–79  ·  view source on GitHub ↗
(map: MapInstance, id: string, props: LayerProps)

Source from the content-addressed store, hash-verified

68}
69
70function createLayer(map: MapInstance, id: string, props: LayerProps) {
71 // @ts-ignore
72 if (map.style && map.style._loaded && (!('source' in props) || map.getSource(props.source))) {
73 const options: LayerProps = {...props, id};
74 delete options.beforeId;
75
76 // @ts-ignore
77 map.addLayer(options, props.beforeId);
78 }
79}
80
81/* eslint-enable complexity, max-statements */
82

Callers 1

LayerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…