Skip to content

useOlModifyEventListener

useOlModifyEventListener(modify, type, listener): void

Defined in: src/use-ol-modify-event-listener.ts:35

Hook to attach an event listener to an OpenLayers Modify interaction. Automatically handles cleanup when the component unmounts or dependencies change.

The OpenLayers Modify interaction instance (null-safe)

Modify | null

ModifyEventType

The type of modify event to listen for (e.g., ‘modifystart’, ‘modifyend’)

ModifyListener

The callback function to execute when the event fires

void

const modify = useOlModify()
useOlModifyEventListener(modify, 'modifyend', (evt) => {
console.log('Modification complete', evt.features)
})