Disabling a command from outside of an AppCommandTarget

Is there a simple way to disable a command from outside of an ApplicationCommandTarget.

I have two components that are both ApplicationCommandTargets, and I need to disable a command in target “A” from target “B” when a command is invoked in “B”. I can set some sort of flag in “A” that gets checked in “A’s” getCommandInfo, but wanted to know if there might be a more elegant way.


No, a target has to make its own decisions about whether a command is enabled, so just having a flag that you change would be the way to do it.