( element: LeafletElement<Layer>, context: LeafletContextInterface, )
| 13 | InteractiveLayerOptions {} |
| 14 | |
| 15 | export function useLayerLifecycle( |
| 16 | element: LeafletElement<Layer>, |
| 17 | context: LeafletContextInterface, |
| 18 | ) { |
| 19 | useEffect( |
| 20 | function addLayer() { |
| 21 | const container = context.layerContainer ?? context.map |
| 22 | container.addLayer(element.instance) |
| 23 | |
| 24 | return function removeLayer() { |
| 25 | context.layerContainer?.removeLayer(element.instance) |
| 26 | context.map.removeLayer(element.instance) |
| 27 | } |
| 28 | }, |
| 29 | [context, element], |
| 30 | ) |
| 31 | } |
| 32 | |
| 33 | export function createLayerHook<E extends Layer, P extends LayerProps>( |
| 34 | useElement: ElementHook<E, P>, |
no outgoing calls
no test coverage detected
searching dependent graphs…