Skip to content

Instantly share code, notes, and snippets.

@charlesjolley
Created August 23, 2010 02:28
Show Gist options
  • Save charlesjolley/544646 to your computer and use it in GitHub Desktop.
Save charlesjolley/544646 to your computer and use it in GitHub Desktop.
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