在我的GWT-Platform应用程序中,我实现了一步从服务器获取数据的方法,下一步依赖于它。我想阻止我的方法进一步执行代码,直到Async调用完成。
应该是简单但我找不到方法。
解决方案我认为您错过了关于网络异步的观点。
在异步调用完成之前阻止客户端代码的执行并不被认为是好的做法(它相当于一种反模式)。
因此,不要在完成异步代码之前阻止执行,请执行以下操作:
In my GWT-Platform application I have implemented method in which one step is to fetch data from server and next step is dependent on it. I want to prevent my method for further execution of the code until the Async call completes.
Should be something simple but I am not finding a way.
解决方案I think you are missing the point about the web being asynchronous.
It is not considered good practice (it is rather an anti-pattern) to block the execution of your client side code until the async call is finished.
So instead of blocking the execution until your async code is finished do following:
更多推荐
阻止方法调用,直到异步调用完成GWT平台
发布评论