-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add computed def as function #31
Add computed def as function #31
Conversation
@JSteunou the code and tests looks good! but I'm trying to understand the practical meaning of this. can you give me example, where it's useful? |
First of all is inheritance. Like Model#defaults or most of Marionette hash attributes being able to be defined those as function allow this computed: function() {
var parentComputed = ParentModel.prototype.computed.apply(this, arguments);
parentComputed.anotherFields = { ... };
return parentComputed;
} Second, it allows immutable definition. Third, it could allow to give parameters to computed, or at least read model properties to return a dynamic computed hash context aware. |
@JSteunou I would ask you to update |
1a6b4ac
to
55e67ef
Compare
|
Add computed def as function
Thank you, that was a fast PR :) |
Do you think a new release could follow? I would love to use this new feature :D |
Will release it soon!
|
|
Really nice, thank you! |
can you also tag the repo with 0.0.12 so that bower can use this feature |
It might address #29 and be nice to have as it will allow to build the computed definition upon model context / options and facilitate inheritance