PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: jgervin on July 15, 2010, 11:27:08



Title: URGENT: How can I get the mediator to listen to all Notifications.
Post by: jgervin on July 15, 2010, 11:27:08
So my stageMediator does some special things and I need it to hear all/every notification that is sent out.  Is there an easy way to do this?  So I don't have to type in all the notification interests in the listNotificationInterests Array?

Sorry about urgency, but a release is going out and requirements have changed and I don't have time to fix the code so just need to the stageMediator to hear everything.

TIA, J


Title: Re: URGENT: How can I get the mediator to listen to all Notifications.
Post by: puremvc on July 15, 2010, 12:55:09
Requirements change at the last minute, eh? That never happens....

Well the framework doesn't really support that any more than AS3 supports a listener that hears every event that's fired. The Mediator usually only needs to be subscribed to the notes it is prepared to handle. Unless you're just printing out the name and contents of the note for debug purposes, I can't think of a reason why the StageMediator would need to be notified of *everything*. And that doesn't sound like a normal production use-case. But without knowing your motivation, I can't say if it's a reasonable thing to want to do or not.

Anyway, you could put a static convenience method (say getAllNoteNames) on the concrete facade that returns an array of all the defined notification constants. And then in the listNotificationInterests method of your StageMediator, you could just call ApplicationFacade.getAllNoteNames() and return the array.

-=Cliff>


Title: Re: URGENT: How can I get the mediator to listen to all Notifications.
Post by: jgervin on July 15, 2010, 02:36:56
The issue seems to be a bug in Flex 4 or in my head. The issue is I have a docked ApplicationControlBar, which should always be in top of the display list, but it isn't.  I have added some new popups and such, which end up showing over top the ApplicationControlBar.  These popups and things are shown based on notifications so for a shortcut to get past the release I planned on just reordering the displayList each time a notification is sent.

Guess I will just listen to all the notifications and do the long way.  Thanks for the quick response.

J


Title: Re: URGENT: How can I get the mediator to listen to all Notifications.
Post by: gohloum on July 23, 2010, 02:07:47
Dont know if this would help, but KapIT has a nice little PureMVCControlPanel which is nice for debugging.  If it's a matter of finding what notification is causing the problem, this may help as it tracks everything going on in the MVC part of the app.

Here is the URLhttp://lab.kapit.fr/display/puremvcconsole/PureMVC+Console (http://lab.kapit.fr/display/puremvcconsole/PureMVC+Console)