Packageorg.spicefactory.parsley.core.state.manager.impl
Classpublic class DefaultGlobalDomainManager
InheritanceDefaultGlobalDomainManager Inheritance Object
Implements GlobalDomainManager

Default implementation of the GlobalDomainManager interface.



Public Methods
 MethodDefined By
  
addContext(context:Context):void
Manages the domain of the specified Context until it gets destroyed.
DefaultGlobalDomainManager
  
addPurgeHandler(domain:ApplicationDomain, handler:Function, ... params):void
Adds a handler to be invoked when an ApplicationDomain is no longer used by any Context.
DefaultGlobalDomainManager
  
putIfAbsent(key:Object, domain:ApplicationDomain):ApplicationDomain
Adds the specified domain if there is no existing domain instance for the same key.
DefaultGlobalDomainManager
Method Detail
addContext()method
public function addContext(context:Context):void

Manages the domain of the specified Context until it gets destroyed.

Parameters

context:Context — the domain to add to the cache

addPurgeHandler()method 
public function addPurgeHandler(domain:ApplicationDomain, handler:Function, ... params):void

Adds a handler to be invoked when an ApplicationDomain is no longer used by any Context.

Parameters

domain:ApplicationDomain — the domain to watch
 
handler:Function — the function to invoke in case the domain is no longer in use
 
... params — any parameters that should be passed to the handler in addition to the domain itself

putIfAbsent()method 
public function putIfAbsent(key:Object, domain:ApplicationDomain):ApplicationDomain

Adds the specified domain if there is no existing domain instance for the same key. The returned domain will either be the one from an existing mapping or the one passed to this method if no mapping existed yet. This helps optimizing domain usage in the framework. If multiple Contexts get created in the same ApplicationDomain it helps keep the reflection cache small if the same ApplicationDomain instance is used then. This is not easy to accomplish as all Flex SDK methods like ApplicationDomain.currentDomain always return a new instance even if it points to the same domain.

This method is primarily intended to be used by ApplicationDomainProvider implementations.

Parameters

key:Object — the key to register the ApplicationDomain with
 
domain:ApplicationDomain — the domain to add

Returns
ApplicationDomain — either the ApplicationDomain from an existing mapping or the one passed to this method if no mapping existed yet