Add event - panel is(not) visible

I need an event to check whether the panel is visible or not. I do some checks every time when layers selection changes but this do not make sense when panel is not visible. With events for panel show/hide I could do only necessary checks.

this is the code I’m using in my UXP JS (vanilla) panel:

document.addEventListener('uxpcommand', (event) => {
  const {
  } = event;
  if (commandId === 'uxpshowpanel') {
    console.log("panel is showing")

  } else if (commandId === 'uxphidepanel') {
    console.log('panel is hiding');

Does this help?

Thanks. I will test.

So I tested that and works well for me :slight_smile:

Thanks for your feedback :grinning: Cheers!