Adobe XD focus in/out

Is there a way to detect when XD gets focus out and focus in?

Does that mean when zoom out / zoom in on Adobe XD? It would be helpful if you could clarify what you mean.

However, it is highly likely not possible, because available events in XD are limited to when a selection is changed, when a panel is displayed, and so on.

I meant to say more in the lines of minimizing the XD app or focused out by some other app

Thanks for your response.

It probably has to rely on OS features. You will be creating a standalone application.

For example, the following code is an AppleScript application that gets the id and path of an app the moment it is focused.