Packageorg.spicefactory.parsley.core.state
Interfacepublic interface GlobalViewState
Implementors DefaultGlobalViewState

Global status information about the view hierarchy. Offers utility function to either find the nearest Context in the view hierarchy above a view instance or allows to configure or wait for a Context to be created in the view hierarchy below a particular view instance.



Public Methods
 MethodDefined By
  
configureFirstChildContext(view:DisplayObject, callback:Function):ChildContextObserver
Waits for the first child Context that gets created somewhere in the view hieararchy at or below the specified view instance.
GlobalViewState
  
findContextInHierarchy(view:DisplayObject, callback:Function, requiredEvent:String = null):void
Finds the nearest Context in the view hierarchy above the specified DisplayObject.
GlobalViewState
  
waitForFirstChildContext(view:DisplayObject, callback:Function, requiredEvent:String = null):ChildContextObserver
Waits for the first child Context that gets created somewhere in the view hieararchy at or below the specified view instance.
GlobalViewState
Method Detail
configureFirstChildContext()method
public function configureFirstChildContext(view:DisplayObject, callback:Function):ChildContextObserver

Waits for the first child Context that gets created somewhere in the view hieararchy at or below the specified view instance. When the first Context gets created it will invoke the specified callback, passing an instance of type BootstrapConfig to the function. This allows to modify the configuration before the Context gets built, like adding a custom scope, specifying setting or adding objects to the Context. At the time the callback gets invoked the actual Context does not exist yet. To get access to the Context the waitForFirstChildContext may be used instead. The returned observer instance allows to specify a timeout or cancel the observer.

Parameters

view:DisplayObject — the view where to wait for the first child Context
 
callback:Function — the callback to invoke, passing an instance of BootstrapConfig

Returns
ChildContextObserver — an observer instance that allows to set a timeout or cancel the operation
findContextInHierarchy()method 
public function findContextInHierarchy(view:DisplayObject, callback:Function, requiredEvent:String = null):void

Finds the nearest Context in the view hierarchy above the specified DisplayObject. This is an asynchronous operation, hence a callback must be specified with one parameter of type Context. It may be invoked with a null value in case no Context is found in the view hierarchy. The third parameter allows to specify an Event (any of the constants of ContextEvent). If specified the callback will not be invoked before that event has fired. If omitted the callback will be invoked as soon as the Context is found.

Parameters

view:DisplayObject — the view to use as a starting point for the Context lookup
 
callback:Function — the callback to invoke as soon as the Context is found and in the required state
 
requiredEvent:String (default = null) — the event that needs to have been fired before the callback gets invoked

waitForFirstChildContext()method 
public function waitForFirstChildContext(view:DisplayObject, callback:Function, requiredEvent:String = null):ChildContextObserver

Waits for the first child Context that gets created somewhere in the view hieararchy at or below the specified view instance. When the first Context gets created it will invoke the specified callback, passing the Context instance to the function. The third parameter allows to specify an Event (any of the constants of ContextEvent). If specified the callback will not be invoked before that event has fired. If omitted the callback will be invoked as soon as the Context is found, most likely passing a Context instance that is not fully initialized yet.

Parameters

view:DisplayObject — the view where to wait for the first child Context
 
callback:Function — the callback to invoke, passing the Context instance that was created
 
requiredEvent:String (default = null) — the event that needs to have been fired before the callback gets invoked

Returns
ChildContextObserver — an observer instance that allows to set a timeout or cancel the operation