Questions about the component system #75
-
|
Hi @graphicore , as I mentioned, I have a few questions about the component system, so I'm creating this public discussion. Hopefully, we can turn this into documentation later. _BaseComponent_BaseComponent seems to be the most essential class to be extended when creating a new component. Subclasses with no HTML outputExamples: UIVisibilityManager and MonitorPlayingState. I assume they extend Subclasses with HTML outputExample: ToggleFullscreen. A common implementation is having a Some of these components create HTML children dynamically inside Note: not a big issue, but I think using a single name, either "component" or "widget", to refer to these entities would make it easier to read the codebase. _BaseContainerComponent_BaseContainerComponent seems to be the solution to components that must instantiate other components, is that correct? But I couldn't find any subclass of Would it be possible for a Because one of the things I wanted to do for the new sidebar design was creating a new
_CommonContainerComponentI see |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Thanks @eomine for starting this. I will add some more remarks to your observarions:
It serves as it mostly as a "leave" in a tree of components. As a leave, Subclasses of this don't spawn other components. Though, the important disambiguation it has to the The implementation of
Generally, with "access to the widgetBus" comes the power the read state, to get notified when state changes, and to write state. There's another way, how components can play a role, which allows for a lot of flexibility, but also must be used with consideration, as it can become confusing. A component can have an Another example for
Right. It is not required to use an
Yes right, the methods to instantiate other components are mainly in
We could tackle this. In my mind everything is a
These are mainly just creating DOM-elements for their zones, which is rather simple to do.
Yes, absolutely. However, I would rather create specific leave type
If you need a customized
Everything uses the DOMTool, you should at least use it to get document reference. If you use
You can use a template directly, there's nothing special in how There are ways around this. For actual static markup, you can create it directly, but in order for
It would be a good idea to document different implementations of |
Beta Was this translation helpful? Give feedback.
Thanks @eomine for starting this. I will add some more remarks to your observarions:
It serves as it mostly as a "leave" in a tree of components. As a leave, Subclasses of this don't spawn other components. Though, the important disambiguation it has to the
_CommonContainerComponentis that it sets[UPDATE_STRATEGY] = UPDATE_STRATEGY_SIMPLE;which changes the signature of theupdatefunction. This is not a strict requirement, a sub-class can also change it'sUPDATE_STRATEGY.UPDATE_STRATEGY_SIMPLEmeansupdate(changedMap)where, the items inchangedMapare thedependenciest…