Plugin Lifecycle events
You can detect whether or not your plugin panel is visible with the help of UXP APIs
IMPORTANT
This is only applicable to plugins with a panel. You cannot detect the execution of a command plugin via these hooks. Familiarize yourself with plugin entrypoints to know the difference between a command and a panel plugin.
Also, for plugins that have multiple panels, you cannot differentiate between them, at present.
Example
JavaScript
manifest
Copied to your clipboardconst entrypoints = require("uxp").entrypoints;entrypoints.setup({panels: {"mainPanel": {create(rootNode) {return new Promise(function (resolve, reject) {console.log('Plugin panel created');resolve();});},destroy(rootNode) {return new Promise(function (resolve, reject) {console.log('Destroy panel');resolve();});}}}});
Copied to your clipboard{/**/"entrypoints": [{"type": "panel","id": "mainPanel","label": "My plugin","minimumSize": {"width": 400,"height": 400},"maximumSize": {"width": 800,"height": 800},"preferredDockedSize": {"width": 400,"height": 400},"preferredFloatingSize": {"width": 600,"height": 600}}]}