Is it possible to set an event listener to trigger when a user-defined config property is changed? Ex.
Ext.define('myClass', {
singleton: true,
config: {
myProperty: null
}
}
And I want to set up a listener so that when I call myClass.setMyProperty('blah');
it gets triggered. Possible?
Generated setters does not fire any event.
However you can define your own setter and fire your custom event from it. Your class have to use Ext.mixin.Observable
mixin (or extend from some class which use this mixin) if you want to fire events from it.
Ext.define('myClass', {
mixins: ['Ext.mixin.Observable'],
singleton: true,
config: {
myProperty: null
},
setMyProperty: function(value) {
this.myProperty = value;
this.fireEvent('myPropertySetted');
}
}