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

Show Posts

* | |

  Show Posts
Pages: [1]
1  PureMVC Manifold / MultiCore Version / Re: removeCore( key ) and onRemove() on: April 22, 2009, 02:20:22
Thank you for your reply!

I have searched the forums for that issue and after faithful reading the posts I think you have missunderstood my concern.

I have no problem with the garbage collector. I want the mediators or proxies to be informed via onRemove() if the core is being removed.

Everything in the facade is fine. All Singletons will be removed an then they could be garbage collected.

:
public static function removeCore( key:String ) : void
{
if (instanceMap[ key ] == null) return;
Model.removeModel( key );
View.removeView( key );
Controller.removeController( key );
delete instanceMap[ key ];
}

But if you dig deeper e.g. into the removeModel function you will see the model will be removed and will be eaten up by the GC. But the proxies will not notice that they are to be removed.

:
public static function removeModel( key:String ):void
{
delete instanceMap[ key ];
}

For my understanding this is an unexpected behavior. Especially when you take a look at the removeProxy function:

:
public function removeProxy( proxyName:String ) : IProxy
{
var proxy:IProxy = proxyMap [ proxyName ] as IProxy;
if ( proxy )
{
proxyMap[ proxyName ] = null;
proxy.onRemove();
}
return proxy;
}

A multiton.removeSomething() produces an onRemove-Call in the corresponding object. Under this condition, I think the removeCore function must do the same.

kind regards

Sven
2  PureMVC Manifold / MultiCore Version / removeCore( key ) and onRemove() on: April 16, 2009, 05:47:03
Hi,

I am working on an multimodular Flexapplication with PureMVC. Sometimes a PureMVC core must be removed.

In that case I expected that the onRemove() function will be called by the framework. In our case we want to close an open Popup if it is still open if the core removes. But nothing happens. So I have cheated the View.as and modified the removeCore( key ) function like that:

:
public static function removeView( key:String ):void
{
var view:View = getInstance( key ) as View;
if (view != null) {
for (var mediator:String in view.mediatorMap) {
view.removeMediator( mediator );
}
}

delete instanceMap[ key ];
}

In my opinion this is the unsurprisingly behavior. I would enjoy it if the framework behavior would be changed like that.

kind regards
Sven

Pages: [1]