This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
array: ['a', 'b', 'c'], | |
lengthBased: Ember.computed('array.length', function() { | |
return this.get('array').join(" "); | |
}), | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
fullName: '', | |
firstName: Ember.computed('fullName', function() { | |
return this.get('fullName').split(' ')[0]; | |
}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
// A computed property chain of property(fullName) <- computed(firstName) <- computed(greeting) will | |
// always recalculate computed(firstName) and computed(greeting) when property(fullName) changes. | |
// This means that computed(greeting) will be recalculated even when computed(firstName) didn't change | |
// as a result of property(fullName)'s change. If you find yourself stuck in an "unnecessary expensive | |
// updates" situation, here is something you can do to optimize: | |
export default Ember.Controller.extend({ | |
appName: 'Optimizing computed property recalculation', | |