| Package | weavejs.core |
| Class | public class LinkableVariable |
| Inheritance | LinkableVariable CallbackCollection Object |
| Implements | ILinkableVariable, ICallbackCollection, IDisposableObject |
| Subclasses | ColorRamp, LinkableBoolean, LinkableNumber, LinkablePlaceholder, LinkableString |
| Property | Defined By | ||
|---|---|---|---|
![]() | callbacksAreDelayed : Boolean [read-only] | CallbackCollection | |
![]() | _linkableObject : ILinkableObject | CallbackCollection | |
| locked : Boolean [read-only]
This is set to true when lock() is called. | LinkableVariable | ||
| state : Object | LinkableVariable | ||
![]() | triggerCounter : uint [read-only] | CallbackCollection | |
![]() | wasDisposed : Boolean [read-only]
This flag becomes true after dispose() is called. | CallbackCollection | |
| Property | Defined By | ||
|---|---|---|---|
| _bypassDiff : Boolean = true
If true, session states will be altered to bypass the diff calculation on DynamicState Arrays. | LinkableVariable | ||
| _locked : Boolean = false
This is set to true when lock() is called. | LinkableVariable | ||
![]() | _preCallback : Function = null
This is the function that gets called immediately before every callback. | CallbackCollection | |
| _primitiveType : Boolean = false
This is true if the _sessionStateType is a primitive type. | LinkableVariable | ||
| _sessionStateExternal : * = undefined
Available externally via getSessionState()
| LinkableVariable | ||
| _sessionStateInternal : * = undefined
Cannot be modified externally because it is not returned by getSessionState()
| LinkableVariable | ||
| _sessionStateType : Class = null
Type restriction passed in to the constructor. | LinkableVariable | ||
| _sessionStateWasSet : Boolean = false
This is true if the session state has been set at least once. | LinkableVariable | ||
| _verifier : Function = null
This function is used to prevent the session state from having unwanted values. | LinkableVariable | ||
| Method | Defined By | ||
|---|---|---|---|
LinkableVariable(sessionStateType:Class = null, verifier:Function = null, defaultValue:*, defaultValueTriggersCallbacks:Boolean = true)
If a defaultValue is specified, callbacks will be triggered in a later frame unless they have already been triggered before then. | LinkableVariable | ||
![]() | 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 | |
![]() | delayCallbacks():void | CallbackCollection | |
detectChanges():void
This function may be called to detect change to a non-primitive session state in case it has been modified externally. | LinkableVariable | ||
dispose():void [override] | LinkableVariable | ||
getSessionState():Object | LinkableVariable | ||
getSessionStateType():Class
The type restriction passed in to the constructor. | LinkableVariable | ||
lock():void
Call this function when you do not want to allow any more changes to the value of this sessioned property. | LinkableVariable | ||
![]() | removeCallback(relevantContext:Object, callback:Function):void | CallbackCollection | |
![]() | resumeCallbacks():void | CallbackCollection | |
setSessionState(value:Object):void | LinkableVariable | ||
![]() | triggerCallbacks():void | CallbackCollection | |
verifyValue(value:Object):Boolean
This function will verify if a given value is a valid session state for this linkable variable. | LinkableVariable | ||
| Method | Defined By | ||
|---|---|---|---|
![]() | _runCallbacksImmediately(... preCallbackParams):void
This function runs callbacks immediately, ignoring any delays. | CallbackCollection | |
sessionStateEquals(otherSessionState:*):Boolean
This function is used in setSessionState() to determine if the value has changed or not. | LinkableVariable | ||
| _bypassDiff | property |
protected var _bypassDiff:Boolean = trueIf true, session states will be altered to bypass the diff calculation on DynamicState Arrays.
| _locked | property |
protected var _locked:Boolean = falseThis is set to true when lock() is called.
| _primitiveType | property |
protected var _primitiveType:Boolean = falseThis is true if the _sessionStateType is a primitive type.
| _sessionStateExternal | property |
protected var _sessionStateExternal:* = undefinedAvailable externally via getSessionState()
| _sessionStateInternal | property |
protected var _sessionStateInternal:* = undefinedCannot be modified externally because it is not returned by getSessionState()
| _sessionStateType | property |
protected var _sessionStateType:Class = nullType restriction passed in to the constructor.
| _sessionStateWasSet | property |
protected var _sessionStateWasSet:Boolean = falseThis is true if the session state has been set at least once.
| _verifier | property |
protected var _verifier:Function = nullThis function is used to prevent the session state from having unwanted values. Function signature should be function(value::Boolean
| locked | property |
locked:Boolean [read-only] This is set to true when lock() is called. Subsequent calls to setSessionState() will have no effect.
public function get locked():Boolean| state | property |
state:Object public function get state():Object public function set state(value:Object):void| LinkableVariable | () | Constructor |
public function LinkableVariable(sessionStateType:Class = null, verifier:Function = null, defaultValue:*, defaultValueTriggersCallbacks:Boolean = true)If a defaultValue is specified, callbacks will be triggered in a later frame unless they have already been triggered before then. This behavior is desirable because it allows the initial value to be handled by the same callbacks that handles new values.
ParameterssessionStateType:Class (default = null) — The type of values accepted for this sessioned property.
| |
verifier:Function (default = null) — A function that returns true or false to verify that a value is accepted as a session state or not. The function signature should be function(value::Boolean.
| |
defaultValue:* (default = NaN) — The default value for the session state.
| |
defaultValueTriggersCallbacks:Boolean (default = true) — Set this to false if you do not want the callbacks to be triggered one frame later after setting the default value.
|
| detectChanges | () | method |
public function detectChanges():voidThis function may be called to detect change to a non-primitive session state in case it has been modified externally.
| dispose | () | method |
override public function dispose():void| getSessionState | () | method |
public function getSessionState():ObjectReturnsObject |
| getSessionStateType | () | method |
public function getSessionStateType():ClassThe type restriction passed in to the constructor.
ReturnsClass |
| lock | () | method |
public function lock():voidCall this function when you do not want to allow any more changes to the value of this sessioned property.
| sessionStateEquals | () | method |
protected function sessionStateEquals(otherSessionState:*):BooleanThis function is used in setSessionState() to determine if the value has changed or not. Classes that extend this class may override this function.
Parameters
otherSessionState:* |
Boolean |
| setSessionState | () | method |
public function setSessionState(value:Object):voidParameters
value:Object |
| verifyValue | () | method |
public function verifyValue(value:Object):BooleanThis function will verify if a given value is a valid session state for this linkable variable.
Parameters
value:Object — The value to verify.
|
Boolean — A value of true if the value is accepted by this linkable variable.
|