Results 1 to 4 of 4

Thread: Error / Warn on missing listeners

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    501

    Default Error / Warn on missing listeners

    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.

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,253

    Default

    It already does this:

    Code:
    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'
                }
            }]
        });
    
    });
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    501

    Default

    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?

  4. #4
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,253

    Default

    We can't know at initialization time. The purpose of the named listeners is that the scope gets resolved at fire time.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •