PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: jgervin on February 15, 2009, 04:11:59



Title: Should notifications always go through a Command
Post by: jgervin on February 15, 2009, 04:11:59
Should all notifications be registered with a command?  If not when should then vs. when shouldn't they?

Should you only registerCommand's when they are big events like on startup, major changes, or shut downs?



Title: Re: Should notifications always go through a Command
Post by: puremvc on February 15, 2009, 08:46:42
Mediators also listen for notifications. For instance, an update notification from a proxy might cause several mediators to be notified so that they can in turn update their view components accordingly.

Aside from coordinating complex activities like startup, commands are also used to update the model in response to interaction at the view. For instance, a menu item or a keystroke or a button press might all lead to the same action of requesting that a proxy fetch its data. By having the mediators for the menu, the component with the button and the stage (keystroke) all send events that lead to the same notification being sent, then the command that responds  to that notification is the only place that the proxy fetch invocation needs to happen.

-=Cliff>