Skip to content

command-handlers/command-switches

The user’s command switches: whether a plugin’s context-menu commands are grouped under one submenu entry, and which of them a context menu offers at all.

PluginSettingsTabComponent owns them and stores them in the plugin’s data.json; command handlers read them at menu time through CommandSwitches, a read-only view, so the menus never write them.

Interface Description
CommandSwitches A read-only view of the user’s command switches, read by command handlers each time a menu is built.
CommandSwitchesRecord The stored form of the command switches, kept under COMMAND_SWITCHES_RECORD_KEY of the library’s reserved data.json record. A wire format between plugin versions and devices: fields are only ever added, and an absent field means the default, so a reset deletes rather than writes a default.
Function Description
parseCommandSwitchesRecord Reads a stored command switches record, dropping whatever part of it is malformed.
Variable Description
COMMAND_SWITCHES_RECORD_KEY The key of the command switches inside the library’s reserved data.json record.