Plugin Lifecycle events

You can detect whether or not your plugin panel is visible with the help of UXP APIs

Example

Copied to your clipboard
const entrypoints = require("uxp").entrypoints;
entrypoints.setup({
panels: {
starterpanel: {
create: async (rootNode) => {
console.log('Plugin panel created');
},
destroy: async (rootNode) => {
console.log('Destroy panel');
}
}
}
});