puremvc中,如何等待sendNotification/notifyObservers完成
在PureMVC / ActionScript中,使用sendNotification或notify-observers发送通知后,如何确保所有观察者都已收到通知并完成工作?
换句话说,就是同步方式的sendNotification。
谢谢
In PureMVC / ActionScript, after sending out notifications using send Notification or notify-observers, how do I make sure all the observers has received the notification and finished the work?
On the other words, is sendNotification in synchronized way.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,执行此操作的正确方法是将所有任务放入 SimpleCommand,然后将所有这些添加到单个 MacroCommand。只要 SimpleCommand 是同步的(例如,您不启动任何加载进程),当 MacroCommand 完成时,您就可以保证其中的所有 SimpleCommand 都已完成。
您可能还想研究 AsyncCommand 实用程序。我不太喜欢这个,但我的一些同事喜欢它。
As far as I know, the proper way to do this is to put all of your tasks in SimpleCommands, and then add all of these to a single MacroCommand. As long as the SimpleCommands are synchronous (eg, you don't start any load processes), when the MacroCommand finished, you are guaranteed that all of the SimpleCommands in it have finished.
You may also want to investigate the AsyncCommand utility. I am not a huge fan of this, but some of my colleagues like it.