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
super access for javascript programmers #1823
Comments
I would bet most people who use Backbone don't use CoffeeScript (though I do =p). This is easily something you can subclass. var MyModel = Backbone.Model.extend({
constructor: function() {
(this.base = this.constructor.__super__).constructor.apply(this, arguments);
}
});
var Vehicle = MyModel.extend({...}); // this.base is accessible
var Car = Vehicle.extend({...}); // same here |
While I would also like to see some support put into backbone core (since it was for coffeescript), I've been using https://github.com/lukasolson/Backbone-Super with some good success (can call |
Thanks for the answers guys, but I know this stuff already. I'm just posting this as a feature request/Pull request since I find it appalling that I should link some 70 lines of code (Backbone-Super) to my project to compensate for a single unwritten line on BB's part. |
This is why I subclass the Backbone vanilla classes for all of my projects, and I think that's the point of Backbone. Little changes like this are easily accomplished without interfering with others' ideas of how the vanilla class should be (see my example above). And if you still want to get this in the core I would set up a proper pull request so merging is just a click away. |
Again, I am not looking for a solution to this. It's been dealt with already. And it's not a question of how the original class should be rather than why is it accommodating another language before javascript. Right now, line 1465 of the development version of Backbone is there only to make Coffeescripters' life easier. Why not add a single extra line or even a few more characters to allow Javascript developers the same benefits? |
closing... This has already been discussed at length, primarily in #787 |
I'll be back..
|
Dear Backbone developers,
I have noticed after browsing your issues and pull requests that there is little love for actual javascript developers, in comparison to the coffeescript variety.
I have been trying to deal with multiple inheritance between objects for some time now and although the recommended method for accessing the super class works, it's not what I would call convenient.
I added a single line after the coffeescript convenience property to tend to this. This solution should not affect the coffeescript convenience and simply make actual javascript development easier.
Here is an example usage: http://jsfiddle.net/yARDp/37/
The text was updated successfully, but these errors were encountered: