【发布时间】:2014-02-06 07:40:14
【问题描述】:
我有一个 ExtJS 单例类。
作为测试,我在 app.js 的 launch() 函数中调用它的一个方法。
但是没有定义单例静态方法。
我认为当我需要课程时,单身人士会变得活跃?
Ext.Loader.setConfig({
enabled : true,
paths: {
'AM': 'app'
}
});
Ext.application({
name: 'AM',
autoCreateViewport: true,
requires: [
'AM.localization.ResourceManager'
],
controllers: [
'Users'
],
launch: function() {
alert(ResourceManager.initBundleLoader());
}
});
Ext.define('AM.localization.ResourceManager', {
alternateClassName: 'ResourceManager',
singleton: true,
init: function() {
this.initBundleLoader();
},
statics: {
test: 'here',
initBundleLoader: function() {
debugger;
Ext.applyIf(Ext.Loader, {
resourceBundles: new Object()
});
},
registerBundle: function(bundleName, locale) {
debugger;
if(!Ext.Loader.hasOwnProperty('resourceBundles')) {
this.initBundleLoader();
}
if(!Ext.Loader.resourceBundles.hasOwnProperty(bundleName)) {
if(Ext.ClassManager.isCreated('AM.locale.' + locale + '.resources.' + bundleName)) {
this.resourceBundles.bundleName = Ext.create('AM.locale.' + locale + '.resources.' + bundleName);
}
}
}
}
});
【问题讨论】: