PureMVC Architects Lounge

PureMVC Manifold => Standard Version => Topic started by: nisimjoseph on March 03, 2009, 12:40:23



Title: registerCommand at Controller class
Post by: nisimjoseph on March 03, 2009, 12:40:23
why do we have the "view.registerObserver(" in the registerCommand function?
what is suppose to do. i pass the code and i can't understand why is that.
please someone can explain me.

10x,
Nisim


Title: Re: registerCommand at Controller class
Post by: puremvc on March 04, 2009, 05:54:04
There are two things that respond to notifications in the PureMVC framework: Mediators and Commands. Mediators are long-lived, and registered with the view. Commands are instantiated only when needed and go away when they're done.

The way that Commands are invoked is that the Controller is actually the notified Observer and its executeCommand method is called with the note. In that method, we discover which Command to instantiate and do so, then pass the noification to its execute method.

-=Cliff>


Title: Re: registerCommand at Controller class
Post by: nisimjoseph on March 04, 2009, 06:41:54
ok, it now more understandable.
so when i send a notification, the Command and the madiator will get execute in the same call, right?

Nisim


Title: Re: registerCommand at Controller class
Post by: puremvc on March 07, 2009, 08:10:18
Correct. For any given notification name, there can be one command and any number of mediators set to be notified.

-=Cliff>