Closed tj closed 11 years ago
would this work like Ember ?
I dont know what ember does, but it would work like I describe haha. Hopefully in a much less ugly way than ember
Sorry I meant as in you would specify the dependencies. I think Ember does something like property.dependencies(firstName, secondName).
yeah you'll have to define it explicitly in some way, I haven't decided on a method name yet
I've got an implementation of something similar at: https://github.com/weepy/attr
curious, does this belong on model? i would have assumed this was the view's responsibility, but am probably just not thinking of a useful case
Seems to me it would be better to keep logic out of the view.
@ianstormtaylor I think I realize now what you were referring to. I just noticed that reactive accepts an optional view parameter for overriding properties. Maybe this is obsolete.
@ianstormtaylor yeah tough call, I like that this would keep the "ugly" in js-land, but I dislike introducing weird ways to define methods that otherwise would just be regular method. Ember's hack on the function prototype is even worse. We need the support at the view level anyway so I think maybe something like reactive(el).computed('fullname', 'first last')
would be a decent compromise
closing for now
add a method to define a method or property as computed, for example if
.fullname
were computed, when either.first
or.last
is updated then emitchange fullname
as well aschange first
/change last