Packageorg.spicefactory.parsley.core.scope
Interfacepublic interface ScopeManager
Implementors DefaultScopeManager

Responsible for managing the scopes associated with a single Context. Each Context has a unique set of scopes associated with it. It may be any combination of scopes inherited from parent Contexts or explicitly created for a Context. When no custom scopes are created the default setup is that each Context is associated with two scopes: One global scope, shared throughout the entire Context hierarchy, and a local scope that just spans a single Context.

Scopes allow to create segments in your application where application messages or lifecycle listeners are only effective for a particular scope, which in turn may span multiple Contexts.



Public Methods
 MethodDefined By
  
dispatchMessage(message:Object, selector:*):void
Dispatches a message through all scopes managed by this instance.
ScopeManager
  
getAllScopes():Array
Returns all scope instances managed by this instance.
ScopeManager
  
getScope(name:String = null):Scope
Returns the scope instance for the specified scope name.
ScopeManager
  
hasScope(name:String):Boolean
Indicates whether this manager contains a scope with the specified name.
ScopeManager
  
Observes the specified command and dispatches messages to registered observers of all scopes managed by this instance when the state of the command changes.
ScopeManager
Method Detail
dispatchMessage()method
public function dispatchMessage(message:Object, selector:*):void

Dispatches a message through all scopes managed by this instance. In many cases you'll want to dispatch application messages through all scopes so that the receiving side can decide which scope it wants to listen for.

Parameters

message:Object — the message to dispatch
 
selector:* (default = NaN) — the selector to use if it cannot be determined from the message instance itself

getAllScopes()method 
public function getAllScopes():Array

Returns all scope instances managed by this instance.

Returns
Array — all scope instances managed by this instance
getScope()method 
public function getScope(name:String = null):Scope

Returns the scope instance for the specified scope name. If the scope name is omitted, the default receiver scope is returned.

Parameters

name:String (default = null) — the name of the scope to look for

Returns
Scope — the Scope instance for the specified name
hasScope()method 
public function hasScope(name:String):Boolean

Indicates whether this manager contains a scope with the specified name.

Parameters

name:String — the name of the scope to look for

Returns
Boolean — true if this manager contains a scope with the specified name
observeCommand()method 
public function observeCommand(command:ObservableCommand):void

Observes the specified command and dispatches messages to registered observers of all scopes managed by this instance when the state of the command changes.

Parameters

command:ObservableCommand — the command to observe