I use this function to hide or undhide the Layers Panel for my plugin workflow:
//If Layers Panel is hidden it shows it, and viceversa.
async function toggleLayersPanel() {
await runCommandID(1098);
}
async function runCommandID(id) {
await core.performMenuCommand({
commandID: id,
kcanDispatchWhileModal: true,
_isCommand: false
});
}
However, for a better experience as a developer and bring a better UX to users, I would like to read if the Layers Panel is hidden or not. Is it possible?
Using F7 or the function above toggles the Layers Panel, but I would know if the user has the Layers Panel visible or not.
Thanks Karmalakas, how is this supposed to work? Does the bp function returns anything? I tried to console.log() the result but it returns a pending promise.
It returns a pending promise. I’m kind of new with promises now in UXP so I don’t get it 100% how it works or how I could get the data from that batchPlay command.
Can you elaborate a little more? I would appreciate it! Seems I don’t get it right enough.
synchronousExecution: true here is the key to get result
It’s a bit strange that with await batchPlay() you get a promise, because await should give you a normal result and then you could get panel like this:
This works now perfect Karmalakas, thank you very much!!
Is there a way that I can make visible or not a specifiic panel with some command like this one? Instead the one I have with the runCommandID() function ?