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: [DEFUSED] facade.removeCore() Possible Bug 1_0_5  (Read 9304 times)
Shoyo
Newbie
*
Posts: 1


View Profile Email
« on: November 16, 2008, 06:39:08 »

I'm using the Multicore 1.0.5 on my project, and I saw some samples using the facade.removeCore() function on the module removal. I tried to use the autocomplete of the IDE but it couldn't find the function.

I checked the API for the method and the signature was described in the documentation as implemented, as you can see here:
http://puremvc.org/pages/docs/AS3/multicore/framework_asdoc/org/puremvc/as3/multicore/interfaces/IFacade.html

Then I went over the source code of IFacade interface and couldn't see the method there. I will post here what I got:

:
/*
 PureMVC MultiCore - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
 Your reuse is governed by the Creative Commons Attribution 3.0 United States License
*/
package org.puremvc.as3.multicore.interfaces
{

/**
* The interface definition for a PureMVC Facade.
*
* <P>
* The Facade Pattern suggests providing a single
* class to act as a central point of communication
* for a subsystem. </P>
*
* <P>
* In PureMVC, the Facade acts as an interface between
* the core MVC actors (Model, View, Controller) and
* the rest of your application.</P>
*
* @see org.puremvc.as3.multicore.interfaces.IModel IModel
* @see org.puremvc.as3.multicore.interfaces.IView IView
* @see org.puremvc.as3.multicore.interfaces.IController IController
* @see org.puremvc.as3.multicore.interfaces.ICommand ICommand
* @see org.puremvc.as3.multicore.interfaces.INotification INotification
*/
public interface IFacade extends INotifier
{

/**
* Register an <code>IProxy</code> with the <code>Model</code> by name.
*
* @param proxy the <code>IProxy</code> to be registered with the <code>Model</code>.
*/
function registerProxy( proxy:IProxy ) : void;

/**
* Retrieve a <code>IProxy</code> from the <code>Model</code> by name.
*
* @param proxyName the name of the <code>IProxy</code> instance to be retrieved.
* @return the <code>IProxy</code> previously regisetered by <code>proxyName</code> with the <code>Model</code>.
*/
function retrieveProxy( proxyName:String ) : IProxy;

/**
* Remove an <code>IProxy</code> instance from the <code>Model</code> by name.
*
* @param proxyName the <code>IProxy</code> to remove from the <code>Model</code>.
* @return the <code>IProxy</code> that was removed from the <code>Model</code>
*/
function removeProxy( proxyName:String ) : IProxy;

/**
* Check if a Proxy is registered
*
* @param proxyName
* @return whether a Proxy is currently registered with the given <code>proxyName</code>.
*/
function hasProxy( proxyName:String ) : Boolean;

/**
* Register an <code>ICommand</code> with the <code>Controller</code>.
*
* @param noteName the name of the <code>INotification</code> to associate the <code>ICommand</code> with.
* @param commandClassRef a reference to the <code>Class</code> of the <code>ICommand</code>.
*/
function registerCommand( noteName : String, commandClassRef : Class ) : void;

/**
* Remove a previously registered <code>ICommand</code> to <code>INotification</code> mapping from the Controller.
*
* @param notificationName the name of the <code>INotification</code> to remove the <code>ICommand</code> mapping for
*/
function removeCommand( notificationName:String ): void;

/**
* Check if a Command is registered for a given Notification
*
* @param notificationName
* @return whether a Command is currently registered for the given <code>notificationName</code>.
*/
function hasCommand( notificationName:String ) : Boolean;

/**
* Register an <code>IMediator</code> instance with the <code>View</code>.
*
* @param mediator a reference to the <code>IMediator</code> instance
*/
function registerMediator( mediator:IMediator ) : void;

/**
* Retrieve an <code>IMediator</code> instance from the <code>View</code>.
*
* @param mediatorName the name of the <code>IMediator</code> instance to retrievve
* @return the <code>IMediator</code> previously registered with the given <code>mediatorName</code>.
*/
function retrieveMediator( mediatorName:String ) : IMediator;

/**
* Remove a <code>IMediator</code> instance from the <code>View</code>.
*
* @param mediatorName name of the <code>IMediator</code> instance to be removed.
* @return the <code>IMediator</code> instance previously registered with the given <code>mediatorName</code>.
*/
function removeMediator( mediatorName:String ) : IMediator;

/**
* Check if a Mediator is registered or not
*
* @param mediatorName
* @return whether a Mediator is registered with the given <code>mediatorName</code>.
*/
function hasMediator( mediatorName:String ) : Boolean;

/**
* Notify <code>Observer</code>s.
* <P>
* This method is left public mostly for backward
* compatibility, and to allow you to send custom
* notification classes using the facade.</P>
*<P>
* Usually you should just call sendNotification
* and pass the parameters, never having to
* construct the notification yourself.</P>
*
* @param notification the <code>INotification</code> to have the <code>View</code> notify <code>Observers</code> of.
*/
function notifyObservers( notification:INotification ):void;

}
}

The Facade.as has the method Implemented:
:
/**
* Remove a Core.
* <P>
* Remove the Model, View, Controller and Facade
* instances for the given key.</P>
*
* @param multitonKey of the Core to remove
*/
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 since the get facade function in the Notifier.as returns an IFacade I get a compile error when I try to removeCore():
:
// Return the Multiton Facade instance
protected function get facade():IFacade
{
if ( multitonKey == null ) throw Error( MULTITON_MSG );
return Facade.getInstance( multitonKey );
}

I hope I could help anyhow. My apologies if I'm doing anything wrong that's giving me the compile error.

Att,
Antonio Sfair
« Last Edit: April 06, 2009, 03:47:05 by puremvc » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: November 16, 2008, 07:20:14 »

Unless I'm mistaken, (I'm on a phone, so I can't check), that method was made static in 1.0.5. This is why there is no IFacade member, since you can only have public instance members defined there.

-=Cliff> 
Logged
Pages: [1]
Print