How to detect when user has selected a layer when plugin is running

Hi, i want my plugin to detect when I select a layer and enable a button in my menu like so:


What sort of event should I be listening for, and where should my handler be implemented ie inside my code.js or the script tag inside my ui.html?

In code.js:

Then use postMessage and get it in ui.html

Please see the developer documentation:

2 Likes

@tank666 thanks, it worked!

Thankyou Its Worked