ChildListCallbackInterface Class
Private Class for use with LinkableHashMap
Constructor
ChildListCallbackInterface
()
private
Item Index
Methods
Properties
- _callbackEntries
- _delayCount
- _disposeCallbackEntries
- _lastNameAdded
- _lastNameRemoved
- _lastObjectAdded
- _lastObjectRemoved
- _lastTriggerStackTrace
- _linkableObject
- _oldEntries
- _precallback
- _runCallbacksCompleted
- _runCallbacksIsPending
- _verifier
- _wasDisposed
- addCallback_stackTrace
- callback
- callbacksAreDelayed
- CLASS_NAME static
- CLASS_NAME static
- CLASS_NAME static
- CLASS_NAME static
- CLASS_NAME static
- CLASS_NAME
- context
- lastNameAdded
- lastNameRemoved
- lastObjectAdded
- lastObjectRemoved
- NS static
- NS static
- NS static
- NS
- NS static
- NS static
- recursionCount
- removeCallback_stackTrace
- schedule
- SESSIONABLE static
- SESSIONABLE static
- SESSIONABLE static
- SESSIONABLE static
- SESSIONABLE static
- SESSIONABLE static
- triggerCounter
- triggered
- triggeredAgain
- wasDisposed
Methods
_runCallbacksImmediately
-
preCallbackParams
This function runs callbacks immediately, ignoring any delays. The preCallback function will be called with the specified preCallbackParams arguments.
Parameters:
-
preCallbackParamsObjectThe arguments to pass to the preCallback function given in the constructor.
_setCallbackVariables
-
name -
objectAdded -
objectRemoved
This function will set the list callback variables: lastNameAdded, lastObjectAdded, lastNameRemoved, lastObjectRemoved, childListChanged
Parameters:
-
nameStringThis is the name of the object that was just added or removed from the hash map.
-
objectAddedILinkableObjectThis is the object that was just added to the hash map.
-
objectRemovedILinkableObjectThis is the object that was just removed from the hash map.
addDisposeCallback
-
relevantContext -
callback
This will add a callback that will only be called once, when this callback collection is disposed.
Parameters:
-
relevantContextObjectIf this is not null, then the callback will be removed when the relevantContext object is disposed via SessionManager.dispose(). This parameter is typically a 'this' pointer.
-
callbackFunctionThe function to call when this callback collection is disposed.
addGroupedCallback
-
relevantContext -
groupedCallback -
triggerCallbackNow
Adds a callback that will only be called during a scheduled time each frame. Grouped callbacks use a central trigger list, meaning that if multiple ICallbackCollections trigger the same grouped callback before the scheduled time, it will behave as if it were only triggered once. For this reason, grouped callback functions cannot have any parameters. Adding a grouped callback to a ICallbackCollection will undo any previous effects of addImmediateCallback() or addDisposeCallback() made to the same ICallbackCollection. The callback function will not be called recursively as a result of it triggering callbacks recursively.
Parameters:
-
relevantContextObjectIf this is not null, then the callback will be removed when the relevantContext object is disposed via SessionManager.dispose(). This parameter is typically a 'this' pointer.
-
groupedCallbackFunctionThe callback function that will only be allowed to run during a scheduled time each frame. It must not require any parameters.
-
triggerCallbackNowBooleanIf this is set to true, the callback will be triggered to run during the scheduled time after it is added.
addImmediateCallback
-
relevantContext -
callback -
runCallbackNow -
alwaysCallLast
This adds the given function as a callback. The function must not require any parameters. The callback function will not be called recursively as a result of it triggering callbacks recursively.
Parameters:
-
relevantContextObjectIf this is not null, then the callback will be removed when the relevantContext object is disposed via SessionManager.dispose(). This parameter is typically a 'this' pointer.
-
callbackFunctionThe function to call when callbacks are triggered.
-
runCallbackNowBooleanIf this is set to true, the callback will be run immediately after it is added.
-
alwaysCallLastBooleanIf this is set to true, the callback will be always be called after any callbacks that were added with alwaysCallLast=false. Use this to establish the desired child-to-parent triggering order.
delayCallbacks
()
This will increase the delay count by 1. To decrease the delay count, use resumeCallbacks(). As long as the delay count is greater than zero, effects of triggerCallbacks() will be delayed.
dispose
()
This function will be called automatically when the object is no longer needed, and should not be called directly. Use disposeObject() instead so parent-child relationships get cleaned up automatically.
handleGroupedCallback
()
Checks the context(s) before calling groupedCallback
removeCallback
-
callback
This function will remove a callback that was previously added.
Parameters:
-
callbackFunctionThe function to remove from the list of callbacks.
resumeCallbacks
()
This will decrease the delay count by one if it is greater than zero. If triggerCallbacks() was called while the delay count was greater than zero, immediate callbacks will be called now.
runCallbacks
-
name -
objectAdded -
objectRemoved
This function will run callbacks immediately, setting the list callback variables before each one.
Parameters:
-
nameString -
objectAddedILinkableObject -
objectRemovedILinkableObject
trigger
()
Marks the entry to be handled later (unless already triggered this frame). This also takes care of preventing recursion.
triggerCallbacks
()
This will trigger every callback function to be called with their saved arguments. If the delay count is greater than zero, the callbacks will not be called immediately.
Properties
_callbackEntries
Array
private
This is a list of CallbackEntry objects in the order they were created.
_delayCount
Number
private
This is the number of times delayCallbacks() has been called without a matching call to resumeCallbacks(). While this is greater than zero, effects of triggerCallbacks() will be delayed.
Default: 0
_disposeCallbackEntries
Array
private
A list of CallbackEntry objects for when dispose() is called.
_lastNameAdded
String
private
returned by public getter
Default: null
_lastNameRemoved
String
private
returned by public getter
Default: null
_lastTriggerStackTrace
String
private
for debugging only... will be set when debug==true
_oldEntries
Array
private
_precallback
Function
protected
This is the function that gets called immediately before every callback.
_runCallbacksCompleted
Boolean
private
This flag is used in _runCallbacksImmediately() to detect when a recursive call has completed running all the callbacks.
_runCallbacksIsPending
Boolean
private
If this is true, it means triggerCallbacks() has been called while delayed was true.
_verifier
Function
private
This function is used to prevent the session state from having unwanted values. Function signature should be function(value:*):Boolean
_wasDisposed
Boolean
private
This value is used internally to remember if dispose() was called.
Default: false
addCallback_stackTrace
String
public
This is a stack trace from when the callback was added.
callback
Function
public
This is the callback function.
callbacksAreDelayed
Boolean
public
While this is true, it means the delay count is greater than zero and the effects of triggerCallbacks() are delayed until resumeCallbacks() is called to reduce the delay count.
CLASS_NAME
String
public
static
TO-DO:temporary solution to save the CLASS_NAME constructor.name works for window object , but modular based won't work
CLASS_NAME
String
public
static
TO-DO:temporary solution to save the CLASS_NAME constructor.name works for window object , but modular based won't work
CLASS_NAME
String
public
static
TO-DO:temporary solution to save the CLASS_NAME constructor.name works for window object , but modular based won't work
CLASS_NAME
String
public
static
TO-DO:temporary solution to save the CLASS_NAME constructor.name works for window object , but modular based won't work
CLASS_NAME
String
public
static
TO-DO:temporary solution to save the CLASS_NAME constructor.name works for window object , but modular based won't work
CLASS_NAME
String
public
temporary solution to save the className for this class/prototype
context
Object
public
This is the context in which the callback function is relevant. When the context is disposed, the callback should not be called anymore.
lastNameAdded
String
public
This is the name of the object that was added prior to running callbacks.
lastNameRemoved
String
public
This is the name of the object that was removed prior to running callbacks.
lastObjectAdded
ILinkableObject
public
This is the object that was added prior to running callbacks.
lastObjectRemoved
ILinkableObject
public
This is the object that was removed prior to running callbacks.
NS
String
public
static
temporary solution to save the namespace for this class/prototype
Default: weavecore
NS
String
public
static
temporary solution to save the namespace for this class/prototype
Default: weavecore
NS
String
public
static
temporary solution to save the namespace for this class/prototype
Default: weavecore
NS
String
public
temporary solution to save the namespace for this class/prototype
NS
String
public
static
temporary solution to save the namespace for this class/prototype
Default: weavecore
NS
String
public
static
temporary solution to save the namespace for this class/prototype
Default: weavecore
recursionCount
Number
public
This is the current recursion depth. If this is greater than zero, it means the function is currently running.
removeCallback_stackTrace
String
public
This is a stack trace from when the callback was removed.
schedule
Number
public
This is 0 if the callback was added with alwaysCallLast=false, or 1 for alwaysCallLast=true
SESSIONABLE
String
public
static
TO-DO:temporary solution for checking class in sessionable
SESSIONABLE
String
public
static
TO-DO:temporary solution for checking class in sessionable
SESSIONABLE
String
public
static
TO-DO:temporary solution for checking class in sessionable
SESSIONABLE
String
public
static
TO-DO:temporary solution for checking class in sessionable
SESSIONABLE
String
public
static
TO-DO:temporary solution for checking class in sessionable
SESSIONABLE
String
public
static
TO-DO:temporary solution for checking class in sessionable
triggerCounter
Number
public
This counter gets incremented at the time that callbacks are triggered and before they are actually called. It is necessary in some situations to check this counter to determine if cached data should be used.
triggered
Boolean
public
If true, the callback was triggered this frame.
Default: false
triggeredAgain
Boolean
public
If true, the callback was triggered again from another grouped callback.
Default: false
wasDisposed
Boolean
public
This flag becomes true after dispose() is called.
