Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ibm mobilefirst 在Worklight中等待函数完成_Ibm Mobilefirst - Fatal编程技术网

Ibm mobilefirst 在Worklight中等待函数完成

Ibm mobilefirst 在Worklight中等待函数完成,ibm-mobilefirst,Ibm Mobilefirst,我的代码中存在等待函数finish的问题: 当我打电话时: 我的问题在myfunction2()中,myarr=0,因为当我运行myfunction1时,它会调用CallFunctionSuch,但当超出 myfunction1、myfunction2在CallFunctionSuch期间被调用尚未完成。 我如何才能等待调用FunctionSucc完成,然后调用myfunction2?感谢您的帮助这样的多后端请求逻辑应该在适配器中实现。您的应用程序应该向适配器发出单个请求。反过来,适配器应该根据

我的代码中存在等待函数finish的问题:

当我打电话时:

我的问题在myfunction2()中,myarr=0,因为当我运行myfunction1时,它会调用CallFunctionSuch,但当超出 myfunction1、myfunction2在CallFunctionSuch期间被调用尚未完成。
我如何才能等待调用FunctionSucc完成,然后调用myfunction2?感谢您的帮助

这样的多后端请求逻辑应该在适配器中实现。您的应用程序应该向适配器发出单个请求。反过来,适配器应该根据需要发出尽可能多的请求,创建响应并将其发送回应用程序


查看高级适配器使用情况和mashup培训以及位于

的示例谢谢,我可以在适配器中编写mashup代码,但是当我需要做一些事情但需要在适配器完成后执行时。有没有办法等到适配器完成后再调用我的函数?在myfunction1()的过程中调用myfunction2()如何?
function myfucntion1()
{
  ....
  // call sql adapter to get data from database
  onSuccess:callfunctionsucc,
  onFailure:calfunctionfail
  ....
}

function callfunctionsucc(data)
{
  //foreach in data
// call myfunction3(item)
}

function myfunction3(item)
{
  ....
  // call sql adapter to get data from database
  onSuccess:callfunctionsucc2,
  onFailure:calfunctionfail2
  ....
}
function  callfunctionsucc2(data)
{
    //foreach in data
  //and set data to myarr is my global variable
}
function myfunction2()
{
  // access to myarr and process it
}
var myarr = [];
myfucntion1();
myfunction2();