// Evented.js源码
Ext.define('Ext.Evented', {
onClassExtended: function(cls, data) {
if (config) {
Ext.applyIf(config, eventedConfig);
}
else {
cls.addConfig(eventedConfig);
}
}
});
Ext.define('MyApp.util.Test', {
extend: 'Ext.Evented',
eventedConfig: {
foo: null
}
});
var test = Ext.create('MyApp.util.Test', {
listeners: {
beforefoochange: function (instance, newValue, oldValue) {
return newValue !== 'bar';
},
foochange: function (instance, newValue, oldValue) {
console.log('foo changed to:', newValue);
}
}
});
test.setFoo('bar');