Skip to content

Instantly share code, notes, and snippets.

@skizzybiz
Created September 21, 2011 18:33
Show Gist options
  • Save skizzybiz/1232904 to your computer and use it in GitHub Desktop.
Save skizzybiz/1232904 to your computer and use it in GitHub Desktop.
Observers for sub-properties don't work when using notifyPropertyChange
X.b.get('prop') // => 0
X.b.setA(X.o)
X.b.get('prop') // => 0
X.b.get('a').get('prop') // => 1
X.b.notifyPropertyChange('prop')
X.b.get('prop') // => 1
X = {
a: SC.Object.create({
prop: 1
}),
b: SC.Object.create({
a: function() {
return this._a;
}.property().cacheable(),
prop: function() {
a = this.get('a');
if (SC.none(a)) return 0;
else return a.get('prop');
}.property('*a.prop').cacheable(),
setA: function(a) {
this._a = a; this.notifyPropertyChange('a');
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment