Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
112
rated 0 times [  114] [ 2]  / answers: 1 / hits: 18594  / 12 Years ago, thu, december 13, 2012, 12:00:00

I am wondering where to add global variables for an ExtJS Application. I already looked at some suggestions in stackoverflow that mention that you can add them inside app.js. But, can anyone be more specific? My app.js looks something like this:



Ext.application({

launch: function() {..}

});


So, where exactly do the variables go? In the launch function? Outside Ext.application?


More From » extjs

 Answers
6

Declare your own object namespace and add them there:



Ext.ns('My.Application.Globals');

My.Application.Globals.SomeValue = 5;
My.Application.Globals.SomeText = 'Hello World!';


However globals are usually frowned upon unless absolutely needed, so try and get around using them if you can.


[#81437] Wednesday, December 12, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jarod

Total Points: 62
Total Questions: 111
Total Answers: 83

Location: Saint Vincent and the Grenadines
Member since Sat, Sep 11, 2021
3 Years ago
jarod questions
;