-
9 Mar 2012 7:45 AM #1
Answered: How to define global config for a sencha app
Answered: How to define global config for a sencha app
Hello everybody,
I'd like to know which's the way to define global configuration to be used from the Controllers and Views. Is there any 'sencha-way' to do so? or should I use just simple javascript global variables which is not, I know, the best way?
Thanks in advance,
-
Best Answer Posted by mitchellsimoens
What I do is have a singleton class..
Then you can doCode:Ext.define('MyApp.util.Config', { singleton : true, config : { foo : 'bar' } });
Code:MyApp.util.Config.getFoo();
-
9 Mar 2012 7:55 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
What I do is have a singleton class..
Then you can doCode:Ext.define('MyApp.util.Config', { singleton : true, config : { foo : 'bar' } });
Code:MyApp.util.Config.getFoo();
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
9 Mar 2012 8:36 AM #3
-
20 Sep 2012 8:41 AM #4
Sorry to bring this thread back from the dead but I have a follow up question.
Is using a singleton object to store variables preferable to using a namespace for the same purpose?
-
16 Dec 2012 6:45 PM #5
Sencha 2.1 andCmd 3.0 config issue
Sencha 2.1 andCmd 3.0 config issue
Hi guys, I used this class as well for my app config, but when I upgrade my sencha I have issue when I try to build production and I have not idea what is the issue :
Code:TypeError: Object #<Object> has no method 'define'
Is someone having the same issue, or do you know a fix bu change.
Thanks in advice .
-
23 Dec 2012 12:12 AM #6


Reply With Quote
