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: Question regarding Mediator reusability  (Read 6162 times)
jkFlex
Newbie
*
Posts: 3


View Profile Email
« on: April 27, 2009, 12:39:49 »

Hi,

I am planning to use a mediator for two different components with different package structures. I have registered the mediators with unique names.
For performing an action in the component how would I get the corresponding component in getter.

Please let me know if any possibilities.

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



View Profile WWW Email
« Reply #1 on: May 02, 2009, 06:16:38 »

Two ways to handle this:

1) Make bothe components implement the same interface. Then have the getter return the Interface rather than the class.

2) Keep a flag in the Mediator that says what kind of component is being held. Have two getters, one for each component type and referenct the appropriate one based on the flag.

Personally I'd opt for #1, and I'd write 2 mediators before doing #2

-=Cliff>
Logged
Pages: [1]
Print