mercredi 1 octobre 2014

Using a singleton for constants does not work on production build (2.4)

Hi,

I'm having an issue with the production build of an app we are developing. This issue can be reproduced like this:



  • Create a new Sencha app via Cmd (CMD 5.0.2 and ST 2.4)

  • Add a util folder inside app with a Constants.js file:



Code:



Ext.define('MyApp.Util.Constants',{
singleton: true,
title: 'MyTitle'
});


  • In app.js I added the following:



Code:



requires: [
'Ext.MessageBox',
'MyApp.util.Constants'
],


  • In app/view/Main.js I changed this line:



Code:



items: [
{
title: MyApp.utils.Constants.title,
iconCls: 'home',

This works fine on development and on the testing build, but fails with the following error on the production build:

Code:



Error evaluating http://localhost/app.js with message: TypeError: Cannot read property 'title' of undefined

From my understanding of the Sencha Class system this should work. I'm I doing something obviously wrong?

Thanks for any assistance....






Using a singleton for constants does not work on production build (2.4)

Aucun commentaire:

Enregistrer un commentaire