虽然目前版本更好,但老版本的返回对象方式是个亮点,记录之
//较早版本:
Ext.blv.moduleProxy=function(config){
Ext.apply(this, config);
//Ext.blv.moduleProxy.superclass.constructor.call(this,config);
}
Ext.extend(Ext.blv.moduleProxy,Ext.blv.moduleProxy,{
moduleName:'',
moudleUrl:'',
getModule:function(moduleParam){
if(Ext.blv.lib.validate.empty(this.moduleName)||Ext.blv.lib.validate.empty(this.moudleUrl)){
return null;
}
var module;
var moduleName=this.moduleName
Ext.Ajax.request({
url: this.moduleUrl,
sync:true,
success: function(response, opts) {
window.eval(response.responseText);
var obj=new Object();
obj.module=eval(moduleName);
module= new obj.module(moduleParam);
},
failure: function(response, opts) {
Ext.Msg.alert("获取模块错误");
}
});
return module;
}
});
inportModule:function(config){
var p={moduleid:null,params:null};
Ext.apply(p, config);
if(null!=p.moduleid){
var moduleProxy=this.moduleProxys.get(moduleid);
if(undefined==moudleProxy) throw new Error("not define that moudle");
return moduleProxy.getModule(p.params);
}else{
throw new Error("not define that moudle");
}
}