Is there a way to automatically reload the panel when the panel window is closed and reopened?
location.reload(); works from a button to reset the panel. However, I would like to run this automatically whenever the panel is closed and reopened.
Is there a way to automatically reload the panel when the panel window is closed and reopened?
location.reload(); works from a button to reset the panel. However, I would like to run this automatically whenever the panel is closed and reopened.
Not sure if this will do what you want.
//Determine if the panel is open or closed
document.addEventListener(âuxpcommandâ, (event) => {
const { commandId } = event
if (commandId === âuxpshowpanelâ) {
console.log(âpanel is showingâ);
showAlert(âOpenâ)
} else if (commandId === âuxphidepanelâ) {
console.log(âpanel is hidingâ);
}
})
Maybe. What document did you find that in? I searched through the docs but didnât see that.
I found it in the Guides How ToâŚ
Thanks, I must have overlooked it in that document. I applied it like this and works exactly as I want it to. I like having the choice for the panel to stay persistent or to reload like this. With CEP, the panels always will reset. There are good use cases for each.
addEventListener('uxpcommand', (event) => {
const { commandId } = event;
if (commandId === 'uxpshowpanel') {location.reload();}
});