Created
August 23, 2010 02:28
-
-
Save charlesjolley/544646 to your computer and use it in GitHub Desktop.
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
var myContact = SC.Object.create({ | |
firstName: 'John', | |
lastName: 'Doe', | |
fullName: function() { | |
return this.getEach('firstName', 'lastName').join(' '); | |
}.property('firstName', 'lastName').cacheable(), | |
fullNameDidChange: function() { | |
console.log('FULL NAME CHANGE!'); | |
}.observes('fullName'); | |
}); | |
myContact.get('fullName'); // 'John Doe'; | |
myContact.set('firstName', 'Frank'); | |
>> FULL NAME CHANGE!! <-- because of dependent keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment