API DocumentationAll Packages | All Classes | Index | Frames
CallbackCollection
 
Packageweavejs.core
Classpublic class CallbackCollection
InheritanceCallbackCollection Inheritance Object
Implements ICallbackCollection, IDisposableObject
Subclasses EventCallbackCollection, LinkableHashMap, LinkableVariable

This class manages a list of callback functions.



Public Properties
 PropertyDefined By
  callbacksAreDelayed : Boolean
[read-only]
CallbackCollection
  _linkableObject : ILinkableObject
CallbackCollection
  triggerCounter : uint
[read-only]
CallbackCollection
  wasDisposed : Boolean
[read-only] This flag becomes true after dispose() is called.
CallbackCollection
Protected Properties
 PropertyDefined By
  _preCallback : Function = null
This is the function that gets called immediately before every callback.
CallbackCollection
Public Methods
 MethodDefined By
  
CallbackCollection(preCallback:Function = null)
CallbackCollection
  
addDisposeCallback(relevantContext:Object, callback:Function, allowDelay:Boolean = false):void
CallbackCollection
  
addGroupedCallback(relevantContext:Object, groupedCallback:Function, triggerCallbackNow:Boolean = false, delayWhileBusy:Boolean = true):void
CallbackCollection
  
addImmediateCallback(relevantContext:Object, callback:Function, runCallbackNow:Boolean = false, alwaysCallLast:Boolean = false):void
CallbackCollection
  
CallbackCollection
  
dispose():void
CallbackCollection
  
removeCallback(relevantContext:Object, callback:Function):void
CallbackCollection
  
CallbackCollection
  
CallbackCollection
Protected Methods
 MethodDefined By
  
_runCallbacksImmediately(... preCallbackParams):void
This function runs callbacks immediately, ignoring any delays.
CallbackCollection
Public Constants
 ConstantDefined By
  DEFAULT_TRIGGER_COUNT : uint = 1
[static] This is the default value of triggerCounter.
CallbackCollection
  STACK_TRACE_TRIGGER : String = This is the stack trace from when the callbacks were last triggered.
[static]
CallbackCollection
Property Detail
_linkableObjectproperty
public var _linkableObject:ILinkableObject

_preCallbackproperty 
protected var _preCallback:Function = null

This is the function that gets called immediately before every callback.

callbacksAreDelayedproperty 
callbacksAreDelayed:Boolean  [read-only]


Implementation
    public function get callbacksAreDelayed():Boolean
triggerCounterproperty 
triggerCounter:uint  [read-only]


Implementation
    public function get triggerCounter():uint
wasDisposedproperty 
wasDisposed:Boolean  [read-only]

This flag becomes true after dispose() is called.


Implementation
    public function get wasDisposed():Boolean
Constructor Detail
CallbackCollection()Constructor
public function CallbackCollection(preCallback:Function = null)

Parameters
preCallback:Function (default = null) — An optional function to call before each immediate callback. If specified, the preCallback function will be called immediately before running each callback using the parameters passed to _runCallbacksImmediately(). This means if there are five callbacks added, preCallback() gets called five times whenever _runCallbacksImmediately() is called. An example usage of this is to make sure a relevant variable is set to the appropriate value while each callback is running. The preCallback function will not be called before grouped callbacks.
Method Detail
_runCallbacksImmediately()method
protected final function _runCallbacksImmediately(... preCallbackParams):void

This function runs callbacks immediately, ignoring any delays. The preCallback function will be called with the specified preCallbackParams arguments.

Parameters

... preCallbackParams — The arguments to pass to the preCallback function given in the constructor.

addDisposeCallback()method 
public function addDisposeCallback(relevantContext:Object, callback:Function, allowDelay:Boolean = false):void

Parameters

relevantContext:Object
 
callback:Function
 
allowDelay:Boolean (default = false)

addGroupedCallback()method 
public function addGroupedCallback(relevantContext:Object, groupedCallback:Function, triggerCallbackNow:Boolean = false, delayWhileBusy:Boolean = true):void

Parameters

relevantContext:Object
 
groupedCallback:Function
 
triggerCallbackNow:Boolean (default = false)
 
delayWhileBusy:Boolean (default = true)

addImmediateCallback()method 
public final function addImmediateCallback(relevantContext:Object, callback:Function, runCallbackNow:Boolean = false, alwaysCallLast:Boolean = false):void

Parameters

relevantContext:Object
 
callback:Function
 
runCallbackNow:Boolean (default = false)
 
alwaysCallLast:Boolean (default = false)

delayCallbacks()method 
public final function delayCallbacks():void

dispose()method 
public function dispose():void

removeCallback()method 
public final function removeCallback(relevantContext:Object, callback:Function):void

Parameters

relevantContext:Object
 
callback:Function

resumeCallbacks()method 
public final function resumeCallbacks():void

triggerCallbacks()method 
public final function triggerCallbacks():void

Constant Detail
DEFAULT_TRIGGER_COUNTConstant
public static const DEFAULT_TRIGGER_COUNT:uint = 1

This is the default value of triggerCounter. The default value is 1 to avoid being equal to a newly initialized uint=0.

STACK_TRACE_TRIGGERConstant 
public static const STACK_TRACE_TRIGGER:String = This is the stack trace from when the callbacks were last triggered.