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

provide and use a good API for registering (view) component handlers #35

Open
antont opened this issue Mar 22, 2014 · 3 comments
Open

Comments

@antont
Copy link
Member

antont commented Mar 22, 2014

(see e-mail for details for now)

@antont
Copy link
Member Author

antont commented Mar 27, 2014

we now have various places in the view code which listen for component additions and handle those.

also apps do that. this is one example, from WebTundra itself:

Application.prototype.onRigidBodyPossiblyAdded = function(entity, component) {
if (! (component instanceof EC_RigidBody))
return;

OTOH we already have nice registerComponent and createComponent in

function registerComponent(typeId, typeName, factory) {

would it be good to use that style for the view handlers and recommend that for apps as well?

@erno
Copy link
Member

erno commented Mar 31, 2014

Re. live discussion, another API issue right now is how the componentCreated and attributeChanged signals currently work.

Currently app code handling components gets a "componentAdded" signal with the default values for attributes and then an attributeChanged signal per attribute as the attributes are decoded from the network.

We could add a signal that's triggered after a createComponent/createEntity message comes in and SyncManager does a "readComponentFullUpdate". The only issue is whether we want to bake this protocol behaviour to the API and what to call the signal. The signal should also be triggerable from user code after creating & initializing a new local component. Something like, componentFullyUpdated (if we want to refer to the protocol concept) or componentReady (for a more straightforward sound?).

@erno
Copy link
Member

erno commented Mar 31, 2014

About reusing the current component registration mechanisms for injecting custom "active" component prototypes to the ec model side of things, that would be a break from the current organisation of the code. So far the design has been that the EC side is inert data and app logic is handled outside of the "model" side. On the other hand the recently merged animation/avatar code does that as well. We should agree on some kind of architectural direction here.

The practical issue of having to check the type of the added component as the first
line of the signal handler can be fixed with a convenience method I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants