Results 1 to 3 of 3

Thread: Global Config Namespace

  1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    5
    Vote Rating
    1
      0  

    Question Global Config Namespace

    I'm having an issue with building my app. In my app.js file I have a namespace defined that looks like this:

    Code:
    Ext.namespace('AiPatientEditor').RESPONSE_TYPE = {
        RESPONSES: 0,
        TIMEOUTS: 1,
        LONGSHOTS: 2,
            DEFAULTS: 3
    };
    The problem is that because it is in the app.js file the above block gets added to the concatenated file last in my build. My other classes higher up in the file can't use it until it's defined obviously.

    A few of my stores depend on this 'enum' to build the proxy url. Does anyone have any ideas on how I can get this namespace block loaded properly for production?
    Last edited by intsims; 3 Apr 2013 at 12:54 PM. Reason: spelling

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Vote Rating
    1288
      0  

    Default

    Why not go for a full singleton class and require it first?

    Code:
    Ext.define('MyApp.util.Config', {
        singleton : true,
    
        foo : 'bar'
    });
    If it's required first then all your classes will have access to MyApp.util.Config.foo
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    5
    Vote Rating
    1
      0  

    Default

    That should work fine. Thanks!

Tags for this Thread

Posting Permissions

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