In puremvc, how to wait for sendNotification/notifyObservers finishes
In PureMVC / ActionScr开发者_如何转开发ipt, 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
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.
精彩评论