-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Very minor re-order of lines in Model constructor #1402
Comments
Heya @davidmarble, thanks for your issue. :) Could you explain to me why you need |
Well, I was hoping not to have to add detailed use cases, as this change does nothing functionally to change any current use of backbone. It just allows access to As noted, There are numerous ways this one data member can be used. For example, accessing configuration information stored on |
If you don't have any use case, I'm inclined to leave it as is to eliminate the chance of a regression. Also, I have lots of experience using |
I didn't expect you'd be so quick to dismiss with the explanation already given and the simplicity of what I'm suggesting. There can't be a regression with this change, The order of these lines is merely a basic code organization decision. Not every change in a project must have clear use cases. This is a simple change that opens up other opportunities for coders to utilize the framework, takes away no functionality that already exists, and adds no explicit new features that should need defending. I'll attempt to write up a specific use case in the name of trying hard to give back to the project by encouraging this minor improvement. An example of code that is impossible to write currently, but would be possible with the above simple change, is commented about under The coffeescript compiled version of the below is here: https://gist.github.com/2922029 (though might seem involved if you're not used to reading coffeescript output). Line 41 of that gist is impossible with the current backbone.js, but is possible with the simple switch above. Example JSON Data Source - a collection of feeds
Super-Collection for multiple Feed models from the JSON above
Feed Model, which includes FeedItems, a nested Collection of FeedItem models
Nested Collection on Feed for FeedItem models. With a little work, if the feeds source supported it, this collection could be used on its own to fetch changes to an individual feed.
Actual feed items
|
Currently
this.collection
is set on a model afterparse
is called:Because
parse
is such a good place to extend backbone, for example to implement nested collections, andthis.collection
can be extremely helpful in doing such extending, could you please modify the code order to:Simple change, shouldn't affect anything else, and gives
parse
one extra piece of information to work with.The text was updated successfully, but these errors were encountered: