1. #1
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,643
    Vote Rating
    480
    LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future

      0  

    Default Ext loads too much code

    See the code fragment... the panel Header loads the Ext.draw.Component.

    The draw.Component requires pretty much the entire draw package. It loads both engines: VML and SVG, and it doesn't event check if the engine is supported. This is a ton of code, see this open ticket.

    I suggest adding conditional resource loading or even creating two header types: Vertical and Horizontal.

    Code:
    Ext.define('Ext.panel.Header', {
        extend: 'Ext.container.Container',
        uses: ['Ext.panel.Tool', 'Ext.draw.Component', 'Ext.util.CSS', 'Ext.layout.component.Body', 'Ext.Img'],

  2. #2
    Sencha - Senior Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,215
    Vote Rating
    1044
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    The issue is that the uses and requires need to be there before the class is created so you can't add to the uses array in the constructor.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,643
    Vote Rating
    480
    LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future

      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    The issue is that the uses and requires need to be there before the class is created so you can't add to the uses array in the constructor.
    I'd consider adding a conditional resource loader... perhaps along the line of yepnope.

    ... but even code like this would be more efficient:

    Code:
    Ext.define('Ext.draw.Surface', {
        ...
        requires: ['Ext.draw.CompositeSprite'],
    
        // uses: ['Ext.draw.engine.Svg', 'Ext.draw.engine.Vml', 'Ext.draw.engine.SvgExporter', 
    'Ext.draw.engine.ImageExporter'],
    
        uses: Ext.supports.Svg ? ['Ext.draw.engine.Svg', 'Ext.draw.engine.SvgExporter', 'Ext.draw.engine.ImageExporter'] : ['Ext.draw.engine.Vml'],
    Most of the time the headers are horizontal, so the drawing package is not needed.
    Last edited by LesJ; 6 Feb 2012 at 8:05 AM. Reason: Correct Ext.supports

Thread Participants: 1