dimanche 13 avril 2014

Cannot find global variable in Cmd testing and production builds

Hello all,

I cannot seem to access a global variable in Ext.application after I do a production or test build with Cmd 4. This happens during the first application launch. I have read other similar threads but there is nothing new in there that can solve my problem for whatever reason.


Before I started using Cmd, I would run my application from a server against the application directory, and things ran just fine. I had no problems with my other files picking up the global variables.


Now that I have moved to Cmd 4 / ST2.3.1, the test and production builds get built into one big app.js file. So it seems that when code that is earlier in the js file calls a global variable, it cannot find it, with the console exception:


Uncaught TypeError: Cannot read property 'targetServer' of undefined


This happens during the first application launch, and the app just hangs. The loading indicators are not even removed.I noticed that the Ext.application code is at the end of the app.js. Could it be some code is launching before the application is fully loaded?


Any idea what I'm missing here? Any help is greatly appreciated. Thanks!


In my app.js, I have the following. This is last in my app.js at line 76623:



Code:



Ext.application({
name: 'qxtapp',
targetServer: 'http://ift.tt/1nkag0w'
...
});

One of my stores looks like this. This is where I get the exception. The below code is earlier in my app.js, at line 70742:


Code:



Ext.define('qxtapp.store.AccountsListStore', {
extend : Ext.data.Store ,
xtype : 'accountsListStore',
config: {
model: 'qxtapp.model.AccountsList',
data: [
{ accountName: qxtapp.app.targetServer+'/account_one' }, <<<--- Causes exception -
cannot read property "targetServer" of undefined
{ accountName: qxtapp.app.targetServer+'/account_two' },
...
]
}
})




Aucun commentaire:

Enregistrer un commentaire