-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Document that when extending Easel display classes you should explicitly call initialize() #25
Comments
Should we have developers explicitly call initialize? or just explicitly call the super class constructor from the constructor of the extending class? i.e.
Thoughts? |
That syntax is certainly neater than that used in the examples bundled with Easel at the moment. Are there any disadvantages over the current suggested?
|
I think that for now, we should address this with documentation. We can re-evaluate this for v0.4. See the Game example (Ship.js and SpaceRock.js) for a functional example of extending existing display objects. |
The question is what do we document? I think:
Is clearer and easier to understand than:
It also requires less internal knowledge about how the base class is implemented. However, perhaps there is a functional difference between the two that is not immediately obvious to me. |
The question is what do we document? I think:
is clearer and easier to understand than:
It also requires less internal knowledge about how the base class is implimented. However, perhaps there is a functional difference between the two that is not immediately obvious to me. |
We are moving this to the 0.4.0 release, so we have some more time to discuss the issue (as well as what the recommended approach for inheritance is). |
I have added a tutorial that specifically addresses this. I'm also going to think further about the ParentClass.call() approach. |
If initialize is not explicitly called then all sorts of things go wonky due to the fact that initialize() is where the display classes setup their children array and get assigned their UID.
The text was updated successfully, but these errors were encountered: