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]
Print
Author Topic: sendNotification between module and main app (multicore)  (Read 6600 times)
lamsek
Newbie
*
Posts: 1


View Profile Email
« on: July 20, 2008, 02:30:45 »

I'm trying out multicore for the first time, and I'm relatively new to PureMVC.

I set up my code so that I have a main app and a module (both in the same project). 

Q. How can I send a notification from my module to the main app?  It seems like the ApplicationFacade classes handle the notification, but since I have two ApplicationFacades, how do I handle communication between them (without tightly coupling my module and my main app).

In the module I have a ViewMediator that calls (note: this applicationFacade is the main one):

:
  protected function showStatus( event:Event ):void
  {
    statusNav.appNavShell.setStatusMessage(StatusNav.SHOW_STATUS_MESSAGE); // works
    sendNotification(ApplicationFacade.VIEW_STATUS); // doesn't work.
  }

In the main app, I have another ViewMediator listening for this:

:
  override public function listNotificationInterests():Array
  {
     return [ ApplicationFacade.VIEW_STATUS
              ];
  }


Thanks,
KL
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: July 21, 2008, 04:50:35 »

Since notification constants are simple strings defined inside each module or app, we don't send notifications between cores.  Instead we either use interfaces or pipes to allow the two cores to communicate.

The Modularity demo shows the shell and modules communicating via interface. The Pipeworks demo shows the use of pipes.

-=Cliff>
Logged
Pages: [1]
Print