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.

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

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

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

Does this help?

2 Likes

Thanks. I will test.

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

Thanks for your feedback :grinning: Cheers!