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: removing an Observer  (Read 7939 times)
barry
Newbie
*
Posts: 2


View Profile Email
« on: September 04, 2009, 07:46:17 »


Hi,

i've just started working with PureMVC and was wondering whether it's possible to remove a single observer from a Mediators notification list? I have a mediator that lists 3 notifications it wants to observe. Once a certain action has occurred i'd like to remove one of the notifications so that the mediator is no longer notified. Is this possible?

I've looked through the pureMVC classes and found that View has a removeObserver() public method, however, this isn't exposed by Facade. I'm presuming there's a reason behind this, so although i could just access view.removeObserver() by extending Facade, this may no be the right/best solution.

Any suggestions on the best way to deal with this would be appreciated.

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



View Profile WWW Email
« Reply #1 on: September 05, 2009, 06:35:00 »

By design, Mediators are long lived actors with fixed interests (like, say Charlton Heston :).

In this case, I'd have a Command respond to the transient interest retrieving the Mediator and executing a method on it rather than having the Mediator be interested. This way, when the Command has performed this one-shot duty, it can unregister itself by calling facade.removeCommand.

-=Cliff>
Logged
barry
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: September 07, 2009, 03:25:02 »


Hi Cliff, thanks a lot for your response, that makes sense.
Logged
Pages: [1]
Print