arduino-create-agent
arduino-create-agent copied to clipboard
Remove global clients
trafficstars
Please check if the PR fulfills these requirements
- [ ] The PR has no duplicates (please search among the Pull Requests before creating one)
- [ ] Tests for the changes have been added (for bug fixes / features)
- What kind of change does this PR introduce? The purpose of this PR is to improve the maintainability, testability, and clarity of the codebase by removing global variables and explicitly passing dependencies as arguments to functions or methods. Global variables can lead to tightly coupled code, making it harder to understand, test, and maintain.
- What is the current behavior?
- What is the new behavior?
-
remove global variables, they are now created in the main function and passed explicitly to the components or functions that need them.
- Tools *tools.Tools
- Systray systray.Systray
- Index *index.Resource
- h = hub
- loggerWs logWriter
- serialPorts SerialPortList
- sh = serialhub
-
move the
go hub.serialPortList.Run()from themaingointo thehub.run()because the hub is in charge of connecting serial events to websocket clients.
- Does this PR introduce a breaking change? No.
- Other information: