PDA

View Full Version : [CLOSED] Error / Warn on missing listeners



brian428
7 Apr 2014, 6:31 PM
If a component declares a listener name and no matching listener is found in the component or the nearest referenceHolder, an error (or at least a console warning) should be generated.

evant
7 Apr 2014, 7:02 PM
It already does this:



Ext.define('MyController', {
extend: 'Ext.app.ViewController',
alias: 'controller.x',

onFoo: function() {
console.log('Ok!');
}
});

Ext.require('*');

Ext.onReady(function() {

new Ext.container.Container({
renderTo: document.body,
width: 200,
height: 200,
controller: 'x',
layout: {
type: 'vbox',
align: 'stretch'
},
items: [{
title: 'Foo',
items: {
xtype: 'button',
text: 'Good',
handler: 'onFoo'
}
}, {
title: 'Bar',
items: {
xtype: 'button',
text: 'Bad',
handler: 'onBar'
}
}]
});

});

brian428
7 Apr 2014, 7:28 PM
Sorry, I meant it should warn/error at initialization time. It would be better to know immediately than have to rely on something actually firing the event (which could happen much later or not at all). Make sense? Thoughts?

evant
7 Apr 2014, 7:34 PM
We can't know at initialization time. The purpose of the named listeners is that the scope gets resolved at fire time.