Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

Encourage decorator-style Ember.computed/Ember.observer #455

Closed
michaelrkn opened this issue Jul 22, 2015 · 1 comment · Fixed by #457
Closed

Encourage decorator-style Ember.computed/Ember.observer #455

michaelrkn opened this issue Jul 22, 2015 · 1 comment · Fixed by #457

Comments

@michaelrkn
Copy link
Contributor

There seems to be general consensus that we should encourage people to use decorator-style methods instead of prototype extensions, except in the case of Array extensions. We should change all places in the guides that use .property to Ember.computed, and .observes to Ember.observer. For example, this:

var president = Ember.Object.create({
  firstName: "Barack",
  lastName: "Obama",

  fullName: function() {
    return this.get('firstName') + ' ' + this.get('lastName');
  }).property()
});

becomes:

var president = Ember.Object.create({
  firstName: "Barack",
  lastName: "Obama",

  fullName: Ember.computed(function() {
    return this.get('firstName') + ' ' + this.get('lastName');
  })
});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants