Currently actions are defined in the manifest, which is only used for generating JSON. The plugin itself has no knowledge of what actions it supports, simply calling methods for events with the ID sent from the Stream Deck app. For small plugins this is fine and can be easily handled with a switch, however once a plugin has a number of actions or actions that involve more complex logic for handling events this becomes messy with each method needing to switch over every action.
If the ActionInstances were registered with the plugin itself then the event handler could also route events to specific actions automatically, only calling the generic event handler if no matching action was found (or if the action doesn't respond to an event).
Currently actions are defined in the manifest, which is only used for generating JSON. The plugin itself has no knowledge of what actions it supports, simply calling methods for events with the ID sent from the Stream Deck app. For small plugins this is fine and can be easily handled with a
switch
, however once a plugin has a number of actions or actions that involve more complex logic for handling events this becomes messy with each method needing toswitch
over every action.If the
ActionInstance
s were registered with the plugin itself then the event handler could also route events to specific actions automatically, only calling the generic event handler if no matching action was found (or if the action doesn't respond to an event).