Available Modal Events

Hi All,

I have a modal that pops up on a button click. I’ve created this modal like so
appEvents.emit('show-modal', { src: 'public/plugins/<panel-id>/editor.html', scope: modalScope, });

Is there an event that I can listen to determine when this modal window has actually opened? I’m trying to grab the id of the modal window but I need to wait for it to open first. Any help much appreciated.

Thanks!

why do you need the id?

The modal that I created is a map editor. I’m using leaflet to create the map, but it needs a container id (Which is in the modal) to attach the map. I can grab the id right now by setting a timeout of 500ms for the modal to open so that the ID is exposed and then I am able to use it to create my map. However, I was keen to see if there’s a better way than using a timeout function(which is kind of hacky). If there’s an event I can listen to check if the modal window is open, that would be awesome. If you have a better approach on doing it, please do share!