Lightswitch html如何知道异步迭代何时完成. [英] Lightswitch html how to know when async iteration is done.
问题描述
您好,请您帮忙.
我在另一个异步操作中有一个异步操作,所以我怎么知道什么时候完成.
I have an async operation inside another async operation so how can i know when everything is done.
这是我的代码
var confirmedGirls = 0;
msls.showProgress(msls.promiseOperation(function(operation){{br/> screen.Staff.getConfirmedWaiters().then(函数(结果){ item.getWaiter().then(function(result){ ; }
&b ; });
; operation.complete(confi rmedGirls);
});
}).then(function(result){
msls.showProgress(msls.promiseOperation(function (operation) {
screen.Staff.getConfirmedWaiters().then(function (result) {
result.each(function (item) {
item.getWaiter().then(function (result) {
if (result.Gender == "Female") {
confirmedGirls++;
}
});
});
operation.complete(confirmedGirls);
});
}).then(function (result) {
...
因此,首先我加载了ConfirmedWaiters集合,当它完成时,我将迭代每个实体并加载一个异步的子实体,因此我想知道迭代何时完成,但问题在于它会立即返回,因为其异步方式如何我可以吗 等到迭代完成,然后执行剩余的代码?
So first i load the ConfirmedWaiters collection, and when it's complete i iterate every entity and load a child entity async, so i want to know when the iteration is complete but the problem is that its returning right away because its async so how can i wait till the iteration is complete and then execute the remaining code?
谢谢
推荐答案
所以我想知道迭代何时完成,但问题在于它由于异步而立即返回,那么我如何才能等到迭代完成之后再执行其余代码?
so i want to know when the iteration is complete but the problem is that its returning right away because its async so how can i wait till the iteration is complete and then execute the remaining code?
在迭代完成之前,如何在应用程序中使用 await操作?
How about using await operation in your application till the iteration is complete.
这篇关于Lightswitch html如何知道异步迭代何时完成.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!