1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    5
    Vote Rating
    0
    intsims is on a distinguished road

      0  

    Question Global Config Namespace

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    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


    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 @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
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    5
    Vote Rating
    0
    intsims is on a distinguished road

      0  

    Default


    That should work fine. Thanks!

Thread Participants: 1

Tags for this Thread