1. #1
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,188
    Vote Rating
    102
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default Why Ext.Loader is included in the generated application?

    Why Ext.Loader is included in the generated application?


    I understand that the Cmd generated all-classes.js file contains (as the name implies) all classes required by the application. This means there's no need to load any more code into the browser(?).

    ...but, the Ext.Loader class is included in the all-classes file. Why do we include the loader in the generated file?

  2. #2
    Sencha Premium Member varsos's Avatar
    Join Date
    Feb 2008
    Location
    Long Island, NY
    Posts
    325
    Vote Rating
    10
    varsos is on a distinguished road

      0  

    Default


    If you try to load a class somewhere inside your code based on a condition and use Ext.require() you would want the Ext.Loader present. After all the compiler may/will not be scanning all of your logic for "required" classes.
    varsos

  3. #3
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,188
    Vote Rating
    102
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default


    Quote Originally Posted by varsos View Post
    If you try to load a class somewhere inside your code based on a condition and use Ext.require() you would want the Ext.Loader present. After all the compiler may/will not be scanning all of your logic for "required" classes.
    I see your point that the Loader might still be useful after the application is built, but in my case this is 1,600 lines of code that is not used. I load all code up front, so perhaps there should be an option to control whether Loader should be included in the built code or not.

  4. #4
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    410
    Vote Rating
    55
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    Quote Originally Posted by LesJ View Post
    I load all code up front, so perhaps there should be an option to control whether Loader should be included in the built code or not.
    Can't you already do that using the "build.operations" property? Either in your Ant build file:

    Code:
    <property name="build.operations"/>
           exclude
               -class=Ext.Loader
    </property>
    Or in your build.properties (or production.properties) file:

    Code:
    build.operations=\
        exclude\n \
            -class=Ext.Loader\n

  5. #5
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,188
    Vote Rating
    102
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default


    I added this line in build.properties

    build.operations=exclude-class=Ext.Loader

    I got an error. Am I doing it right?

    [ERR]
    [ERR] BUILD FAILED
    [ERR] com.sencha.exceptions.ExArg: Unknown command: "exclude-class=Ext.Loader"
    [ERR]
    [ERR] Total time: 3 seconds
    [ERR] The following error occurred while executing this line:
    /Applications/MAMP/htdocs/cme/risk/.sencha/app/build-impl.xml:591: The following error occurred while executing this line:
    /Applications/MAMP/htdocs/cme/risk/.sencha/app/build-impl.xml:551: com.sencha.exceptions.ExArg: Unknown command: "exclude-class=Ext.Loader"

  6. #6
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    410
    Vote Rating
    55
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      1  

    Default


    Sencha Cmd will only accept one argument per line, so you'll need to include the value exactly as I have shown it above. The backslash at the end of each line indicates that the property value continues on the next line, and the "\n" includes a newline character in the property value (these are part of the Java properties file format, which you can read about here). Technically, if you want to keep the value on a single line of your properties file you could do this:

    Code:
    build.operations=exclude\n-class=Ext.Loader\n
    But I find breaking up the lines to be much more readable:

    Code:
    build.operations=\
        exclude\n \
            -class=Ext.Loader\n

  7. #7
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    410
    Vote Rating
    55
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    Also, as I've been thinking about this, one other pitfall to watch out for is that the Ext.onReady method calls Ext.Loader.onReady under the hood (source) so it seems that any onReady calls you have wouldn't work if you exclude the loader. If that applies to you, then you may have to modify your code to use Ext.onDocumentReady or some other method instead...

  8. #8
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,188
    Vote Rating
    102
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default


    Thanks, but I see that excluding the Loader is not going to work. I managed to exclude the Loader, but now I'm getting an error. Looks like the Loader can't be excluded.Screen Shot 2013-06-27 at 10.48.55 AM.jpg

  9. #9
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    410
    Vote Rating
    55
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    Yeah, it looks like we both came to the same conclusion just a few minutes apart!

    It might be possible to work around (using a custom onReady that uses Ext.Loader if it exists and Ext.onDocumentReady if it doesn't), but frankly I'm not sure that it's worth the effort just to cut down the compiled file by a few lines...

  10. #10
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,188
    Vote Rating
    102
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default


    Quote Originally Posted by burnnat View Post
    Yeah, it looks like we both came to the same conclusion just a few minutes apart!

    It might be possible to work around (using a custom onReady that uses Ext.Loader if it exists and Ext.onDocumentReady if it doesn't), but frankly I'm not sure that it's worth the effort just to cut down the compiled file by a few lines...
    Nope, it's not worth the effort, but I appreciate your responses. At least I learned how to exclude a class

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar