Skip to content

Instantly share code, notes, and snippets.

@sevifives
Created July 7, 2011 13:30
Show Gist options
  • Save sevifives/1069505 to your computer and use it in GitHub Desktop.
Save sevifives/1069505 to your computer and use it in GitHub Desktop.
var person = SC.Object.create({
firstName: 'John',
lastName: 'Smith',
fullName: function () {
var first = this.get('firstName');
var last = this.get('lastName');
return '%@ %@'.fmt(first,last);
}.property('firstName','lastName').cacheable()
});
person.get('firstName'); // 'John'
person.get('lastName'); // 'Smith'
person.get('fullName'); // 'John Smith'
person.set('firstName','Dan'); // 'Dan'
person.get('fullName'); // 'Dan Smith'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment