【发布时间】:2014-07-10 17:01:16
【问题描述】:
我希望执行顺序如下。 1. 取消附加(x) 2.更新列表(y) 3. console.log("函数更新执行完成")
只有在两个函数(unattach 和 updateLists)都完成执行后,更新函数才会返回。问题是我无法让它等待两个函数完成执行。 return 语句有问题吗?
function main()
{
when(update).then(function(){
console.log("completed execution of function update");
});
}
function update()
{
return when(function(){
unattach(x);
}).then(function(){
updateLists(y);
});
}
【问题讨论】: