Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PoC] Components #4278

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

[PoC] Components #4278

wants to merge 3 commits into from

Conversation

CommandMC
Copy link
Collaborator

Components, as the name suggests, are a way to express parts of Heroic in a modular, interconnected manner. Components are incentivized to be as small as possible; ideally one component does one task.
In the logger example, you can see that there's one component creating the log file, another clearing it, and a 3rd finally writing to it. If we ever want to modify any part of this process (say we want to add a header to any log files), we just have to change the one component, and everything else automatically adapts & is non-the-wiser about the change.

This interconnectedness is achieved by a messaging system, similar to perhaps Electron's IPC or our backendEvents. For further details on it, see the comment in backend/components/registry/types.ts.
Components can both define their own messages as well as calling the ones defined by other components.

For an example on what components might look like, as mentioned, see the logger example.

Note: As-is right now, you'll see some warnings in your IDE around the non-exclusive producers. Those are simply caused by not having any producers in the system yet and can be ignored.

TODO (rough):

  • Loading user components
  • Hot-reloading components
  • Easier access to components from non-components (current syntax is a bit awkward)
  • More components

Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

I don't intend this to stay at all, this is just to show off how modular the
system can be
Just to give the logger a whirl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant