You can register anytime before you need to ask for the singleton.
Since our managers get used early in startup, we register them as early
as possible.  You might be able to wait longer, even as late as
creationComplete.  In some apps, the popup manager is loaded in a module
that is loaded way after the app started.

 

We register interfaces instead of classes for version control.  If a
module in an application requires an older version of the framework, it
will live in its own application domain and thus not share the same
singleton as the main app.  What we promise is that the interfaces will
never change, and the interfaces are put in a bootstrap app domain.
Then when you ask for the singleton, you can share it across app
domains.

 

-Alex

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael Schmalle
Sent: Thursday, January 11, 2007 1:38 PM
To: [email protected]
Subject: [flexcomponents] Singleton :: Where to register with classMap

 

Hi,

I have managers I am implementing singletons with.

I am trying to stick to the singleton pattern. I see that yor singletons
are registered in the systemManager frame 2 handler.

I also see that you are not using registerInitCallbacks() anymore. 

So the question is... Where do I put my line of code that registers the
implementation class with the Singleton class map?

IE you have

Singleton.registerClass("mx.managers::ICursorManager ",
Class(getDefinitionByName("mx.managers::CursorManagerImpl")));

I want

Singleton.registerClass("com.teotiGraphix.manager::IMoveManager",
Class(getDefinitionByName("com.teotiGraphix.manager::MoveMangerImpl
")));

Also, why do you use the interface name when registering the class, is
that so others can override you implementation? (with the same register
call)... This is the first time I actually thought about it this way.
;-) 

Peace, Mike

PS I have been kind holding back on releasing components thus far
because I wanted my managers piped into this new algorithm.


-- 
Teoti Graphix
http://www.teotigraphix.com <http://www.teotigraphix.com> 

Blog - Flex2Components
http://www.flex2components.com <http://www.flex2components.com> 

You can find more by solving the problem then by 'asking the question'. 

 

Reply via email to