emorydunn / StreamDeckPlugin

A library for creating Stream Deck plugins in Swift.
https://emorydunn.github.io/StreamDeckPlugin/
MIT License
50 stars 7 forks source link

Explore Options for Incorporating Actions into the Event Stream #6

Closed emorydunn closed 2 years ago

emorydunn commented 2 years ago

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).