EXTJS 4构建,单身不叫?

时间:2017-05-07 23:57:32

标签: javascript extjs extjs4

我想让我的应用程序处于生产模式,我遇到问题,我的js代码一直抱怨缺少javascript对象而不能运行,

在我的app.js中我有这个

requires: [
    "FleetM.utility.SharedData"
],

并且这个共享数据在所有控制器中使用并查看为名为SharedData的单例,但是在构建之后,缩小的js会保留SharedData缺失,但是如果我把它放在控制台中它会打印所有值,即使我使用未压缩的js结果相同,这是我的SharedData类

Ext.define('FleetM.utility.SharedData', {
    alternateClassName: 'SharedData',
    singleton: true,
    'PreventALLUpdateDelete': 0,
    'vehicles_creation': 0,
 //..... alot of varibles here 
    'appSettings': 0,
    'user': 0,
    'i18n': 0,
    success_load: false,
    'comWizard': 0,
    constructor: function () {

        Ext.Ajax.request({
            url: "USERS/GetAccessLevelData",
            method: 'GET',
            scope: this,
            success: function (response, opts) {
                var data = Ext.decode(response.responseText, true);
                try {
                    SharedData.user = data;
                    SharedData.user.Connected=1;
                } catch (err) {
                }

                try {
                    SharedData.PreventALLUpdateDelete = data.PreventALLUpdateDelete;
                    SharedData.vehicles_creation = data.vehicles_creation;

                    var language = SharedData.user.language;
                } catch (err) {
                }


                switch (language) {
                    case '0':
                        language = "En";
                        break;
                    case '1':
                        language = "Ar";
                        break;
                    default:
                        language = "En";
                        break;
                }

                this.LoadI18n(language);
                success_load: true;
            },
            failure: function (err) {
                //Ext.MessageBox.alert(SharedData.i18n.Reports.ErrorMsg, SharedData.i18n.Reports.tryAgain);
            }
        });

    },
    LoadI18n: function (language) {
        var me = this;

        Ext.Ajax.request({
            url: "data/i18n" + language + ".json",
            method: 'GET',
            scope: this,
            success: function (response, opts) {
                var data = Ext.decode(response.responseText, true);
                try {
                    SharedData.i18n = data;
                } catch (err) {
                }
                me.success_load = true;
            },
            failure: function (err) {
                //Ext.MessageBox.alert(SharedData.i18n.Reports.ErrorMsg, SharedData.i18n.Reports.tryAgain);
            }
        });
    }
});

---- ---- UPDATE

  

我已经为所有控制器和视图添加了需求,它仍然存在   抱怨

看下面的图片,

requires exist when i call from console i can read it

0 个答案:

没有答案