I’m trying to run some code whenever a new property is set on an object. I tried:
var MyObject = Ember.Object.extend({
setUnknownProperty: function(k,v){
runMyCode()
return;
}
});
I relayed on this doc for Object.set:
If setUnknownProperty() returns undefined, then set() will simply set the value on the object
But it didn’t! If I remove setUnknownProperty method, the property is set, but with it it just doesn’t. I also tried:
setUnknownProperty: function(k,v){
this[k] = v;
this.notifyPropertyChange(k);
return v;
}
But with no luck.