ember.js - Are function prototypes going away in Ember 2? -
since latest ember release @ http://emberjs.com/blog/2015/05/13/ember-1-12-released.html seems there new syntax setter , getter methods.
should getting used doing:
fullname: ember.computed('firstname', 'lastname', function() { return this.get('firstname') + ' ' + this.get('lastname'); }) instead of:
fullname: function() { return this.get('firstname') + ' ' + this.get('lastname'); }.property('firstname', 'lastname')
short answer: no, wait decorators land in ember , switch.
longer answer: function() { }.property() way of declaring computed properties depends on extending function prototype. extending prototypes of javascript 'primitives' seen bad practice.
the ember.computed(function() { }) way same former, except prototype extension not used.
there ongoing discussion on way better on ember.js github. can find here.
also in near future another, cleaner, way of declaring computed properties using decorators, should come ember. computed properties this:@computed foo() { }. these mentioned in blog post link to. can find more details on these here.
my opinion should wait decorators , make switch.
Comments
Post a Comment