我有一个xe:jsonRpcService,我想传递给一个csjs类。这怎么可能?将xe:jsonRpcService传递给csjs类
服务:
<xe:jsonRpcService id="jsonRpcService1" serviceName="rpcServices">
<xe:this.methods>
<xe:remoteMethod name="loadEntity"
script="PersonBean.loadEntity(id);">
<xe:this.arguments>
<xe:remoteMethodArg name="id" type="string"></xe:remoteMethodArg>
</xe:this.arguments>
</xe:remoteMethod>
</xe:this.methods>
</xe:jsonRpcService>
呼叫我的课在输出脚本:
formHelper = new FormHeler(rpcServices) ;
的csjs类:
function Formhelper(service) {
//...
this.loadEntity = function(id) {
//...
resultObj = service.loadEntity(id) ;
//...
}
}
在类作品使用rpcServices.loadEntity。但我想将它作为参数传递,所以我可以使用具有不同服务的类。
rpcServices作为类构造函数的参数不起作用。是否有另一种方法将引用传递给服务并使其在课程中可用?