1. #1
    Ext JS Premium Member
    Join Date
    Jul 2011
    Posts
    33
    Vote Rating
    0
    FPXdeveloper_4 is on a distinguished road

      0  

    Default Ext.require vs Ext.class.requires

    Ext.require vs Ext.class.requires


    It has been said often in here that the SDK tools need files to use the "uses" or "require" statements. Can we also use the Ext.class.requires array? http://docs.sencha.com/ext-js/4-0/#!...s-cfg-requires

    I have preferred using these over the Ext.require statement. It seems cleaner. Do I need to switch to using Ext.require?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    827
    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


    You should definitely use the requires/uses throughout your application files. This tells the SDK tools what order to build the jsb3 file. Placing classes in the requires property says that those classes need to be defined before this class is defined. uses says that those classes need to be defined before this class is instantiated.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    Ext JS Premium Member
    Join Date
    Jul 2011
    Posts
    33
    Vote Rating
    0
    FPXdeveloper_4 is on a distinguished road

      0  

    Default


    Thanks for the reply. Now given that I am using Ext.class.requires, do I also need to use Ext.require?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    827
    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


    Quote Originally Posted by FPXdeveloper_4 View Post
    Thanks for the reply. Now given that I am using Ext.class.requires, do I also need to use Ext.require?
    I only use it if I want to bulk load things... like 'Ext.chart.*' but if you have things setup throughout your application, you probably don't really need it.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

  5. #5
    Sencha User
    Join Date
    Dec 2011
    Location
    San Jose
    Posts
    20
    Vote Rating
    0
    DocAhrens is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Placing classes in the 'requires' property says that those classes need to be defined before this class is defined. 'uses' says that those classes need to be defined before this class is instantiated.
    With 'requires' vs 'uses', is there a difference in when the files are loaded or are there performance implications of using 'requires' over 'uses' or vice versa? Should we be using 'uses' most of the time and only use 'requires' when 'uses' isn't enough?

Thread Participants: 2