Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Chained setting of data to component #16

Closed
danielkcz opened this issue Dec 13, 2015 · 0 comments
Closed

Chained setting of data to component #16

danielkcz opened this issue Dec 13, 2015 · 0 comments

Comments

@danielkcz
Copy link
Contributor

In the light of upcoming PR #15, this is another change that would simplify things. With component registry it's much easier to add component into entity, but since it has no data, it might be less useful. Let's improve it like this.

entity.add('personComponent')
    .set('firstName', 'Daniel')
    .set('lastName', 'K.');

This would obviously require to introduce small breaking change since entity.add returns entity instance itself. In my opinion it's not that useful as having component returned.

Adding the set method on component instance might be also seen as a step toward the future and perhaps implement some more sophisticated ways of setting component data.

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

No branches or pull requests

1 participant