Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Author Topic: Should notifications always go through a Command  (Read 7452 times)
Courseware Beta
Sr. Member
Posts: 50

View Profile Email
« 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?

Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #1 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.

Pages: [1]