This repository was archived by the owner on Apr 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 116
Implement new Component class and ObjectPool #168
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a498a34
to
1aed01a
Compare
fernandojsg
reviewed
Jun 9, 2020
Great work with this ! Component schema definition with upcoming proposal-class-fields. Will make some really clear/consice Components : import { Component, Types } from "ecsy"
class MyComponent {
static schema = {
aNumber: { type: Types.Number },
anArray: { type: Types.Array },
}
} |
@IfnotFr indeed! currently it's a bit uglier but it's fine so far. but when the static will arrive both the Component definition and the System's queries will be prettier for sure :) |
4158d05
to
3095368
Compare
3095368
to
6424e95
Compare
6424e95
to
87268cd
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is intended to make the component class more straightforward, predictable, and accessible to tooling.
Object pooling is now handled with
.copy()
and.clone()
methods rather than.reset()
. The Component class comes with a default implementation for the constructor, copy, and clone that is based on the component schema.Components must now be registered, an error will be thrown if you attempt to add a component before it is registered. On component registration we validate the schema. Components must also now extend the
Component
class.Schema types have a new interface. They must implement
name, default, copy, and clone
. Types are validated upon registration.The
createComponentClass
helper has been removed. You should now use theComponent
class instead.To Do:
createComponentClass()
createType()
docs.reset()
.copy()
and.clone()
docsObjectPool
docs.copy()
.clone()
Closes #147
Closes #118