Check if modal is open or closed

Is it possible to retrieve the information if the modal page of a FastTemplate is open or closed?
The background is that I have a tabulator table displayed two times, one time in the modal area and one time in the main area. I want to check every time the table is clicked and do different things depended on modal is open or closed.