我遇到一个问题:callWebsocket
对话框动作的功能def.preProcessor
没有被暂停。结果this.ws.call
得到评估。我希望this.ws.call
等待def.preProcessor
对话框操作的结果。
export class ApiService {
VmStart:{
apiCall:{
....
},
async preProcessor(def:ApiCall, self ) {
self.dialog.confirm("OverCommit","Overcommit memory?").subscribe((res)=>{
console.log(res);
});
return def;
},
},
}
async callWebsocket(evt:CoreEvent,def){
let cloneDef = Object.assign({}, def);
if(evt.data){
cloneDef.apiCall.args = evt.data;
// PreProcessor: ApiDefinition manipulates call to be sent out.
if(def.preProcessor){
cloneDef.apiCall = await def.preProcessor(def.apiCall, this);
}
let call = cloneDef.apiCall;//this.parseEventWs(evt);
this.ws.call(call.namespace, call.args).subscribe((res) => {
});
}
}