我有一个应用程序,在发布时做了这个丑陋的事情:
Ext.lang = function (langId) {
if (Ext.local[langId]) {
return Ext.local[langId];
}
if (!localStorage.getItem('localLangBackup')) {
delete window.localStorage.localLang;
localStorage.setItem('localLangBackup', true);
}
return langId;
}
我很想重构这件事:
Ext.define('Ext.lang',{whatever gous in here...})
但到目前为止没有运气,因为当我尝试时:
Ext.define('Ext.lang', function (langId) {
if (Ext.local[langId]) {
return Ext.local[langId];
}
if (!localStorage.getItem('localLangBackup')) {
delete window.localStorage.localLang;
localStorage.setItem('localLangBackup', true);
}
return langId;
});
我得到了
Class.extend不是函数