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

Using this before calling super() #33

Open
andrewrota opened this issue Apr 7, 2015 · 1 comment
Open

Using this before calling super() #33

andrewrota opened this issue Apr 7, 2015 · 1 comment

Comments

@andrewrota
Copy link

Classes in ES6 require super() to be called before you can use this in a constructor (now enforced in Babel 5.x), but todo-app.js needs to do this a few times to support property values such as this.events and this.tagName. Is there a way to refactor this so the properties can be initialized after calling super() (though so far I haven't been able to think of a way this would work with Backbone out of the box)?

[UPDATE] Relevant Backbone issue: jashkenas/backbone#3560

@jamiebuilds jamiebuilds mentioned this issue May 4, 2015
@shrimpwagon
Copy link

I am having the exact same issue. I have not found a solution but the only thing I came up with is calling super() twice. Once immediately after construct() so this is available and then super() towards the end of construct() to initialize the this.events and this.tagName properties after they have been set. This just seems like a wrong way to make it work but I have not found another solution on the internet.

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

No branches or pull requests

2 participants