API DocumentationAll Packages | All Classes | Index | Frames
Weave
 
PackageTop Level
Classpublic class Weave
InheritanceWeave Inheritance Object
Implements IDisposableObject



Public Properties
 PropertyDefined By
  beta : Boolean = false
[static]
Weave
  history : SessionStateLog
The session history
Weave
  root : ILinkableHashMap
The root object in the session state
Weave
Public Methods
 MethodDefined By
  
Weave
  
AS(object:Object, type:Class):*
[static]
Weave
  
classInfo(info:Object):Function
[static] Decorator-generator for registering a class.
Weave
  
className(def:Object):String
[static] Gets the qualified class name from a class definition or an object instance.
Weave
  
combineDiff(baseDiff:Object, diffToAdd:Object):Object
[static] Shortcut for WeaveAPI.SessionManager.combineDiff()
Weave
  
computeDiff(oldState:Object, newState:Object):Object
[static] Shortcut for WeaveAPI.SessionManager.computeDiff()
Weave
  
copyState(source:ILinkableObject, destination:ILinkableObject):void
[static] Shortcut for WeaveAPI.SessionManager.copySessionState()
Weave
  
detectChange(observer:Object, linkableObject:ILinkableObject, ... moreLinkableObjects):Boolean
[static] This function is used to detect if callbacks of a linkable object were triggered since the last time this function was called with the same parameters, likely by the observer.
Weave
  
disposableChild(disposableParent:Object, disposableChildOrType:Object):*
[static] Shortcut for WeaveAPI.SessionManager.newDisposableChild() and WeaveAPI.SessionManager.registerDisposableChild()
Weave
  
dispose():void
Weave
  
dispose(object:Object):void
[static] Shortcut for WeaveAPI.SessionManager.disposeObject()
Weave
  
findPath(root:ILinkableObject, descendant:ILinkableObject):Array
[static] Shortcut for WeaveAPI.SessionManager.getPath()
Weave
  
[static] Shortcut for WeaveAPI.SessionManager.getObject()
Weave
  
getAncestor(descendant:ILinkableObject, ancestorType:Class):ILinkableObject
[static] Finds the closest ancestor of a descendant given the ancestor type.
Weave
  
getAsyncInstanceHandler(type:Class):Function
[static] Gets the function that was passed in to registerAsyncClass() for a given type.
Weave
  
[static] Shortcut for WeaveAPI.SessionManager.getCallbackCollection()
Weave
  
getDefinition(name:String, throwIfNotFound:Boolean = false):*
[static] Looks up a static definition by name.
Weave
  
getDescendants(object:ILinkableObject, filter:Class = null):Array
[static] Shortcut for WeaveAPI.SessionManager.getLinkableDescendants()
Weave
  
Gets the ILinkableObject at a specified path.
Weave
  
[static] Shortcut for WeaveAPI.SessionManager.getLinkableOwner()
Weave
  
[static] Gets a WeavePath from an ILinkableObject.
Weave
  
[static] Finds the root ILinkableHashMap for a given ILinkableObject.
Weave
  
getState(linkableObject:ILinkableObject):Object
[static] Shortcut for WeaveAPI.SessionManager.getSessionState()
Weave
  
getWeave(object:Object):Weave
[static] Finds the Weave instance for a given Object.
Weave
  
id(arg:*):*
[static] Shortcut for DebugUtils.debugId() and DebugUtils.debugLookup()
Weave
  
IS(object:Object, type:Class):Boolean
[static]
Weave
  
isAsyncClass(type:Class):Boolean
[static] Checks if a class is or extends one that was registered through registerAsyncClass().
Weave
  
isBusy(object:ILinkableObject):Boolean
[static] Shortcut for WeaveAPI.SessionManager.linkableObjectIsBusy()
Weave
  
isLinkable(objectOrClass:Object):Boolean
[static] Checks if an object or class implements ILinkableObject
Weave
  
lang(text:String, ... parameters):String
[static] This is a convenient global function for retrieving localized text.
Weave
  
linkableChild(linkableParent:Object, linkableChildOrType:Object, callback:Function = null, useGroupedCallback:Boolean = false):*
[static] Shortcut for WeaveAPI.SessionManager.newLinkableChild() and WeaveAPI.SessionManager.registerLinkableChild()
Weave
  
linkState(primary:ILinkableObject, secondary:ILinkableObject):void
[static] Shortcut for WeaveAPI.SessionManager.linkSessionState()
Weave
  
macro(name:String, ... params):*
For backwards compatibility, may be temporary solution
Weave
  
path(... basePath):WeavePath
Creates a WeavePath object.
Weave
  
privateLinkableChild(linkableParent:Object, linkableChildOrType:Object, callback:Function = null, useGroupedCallback:Boolean = false):*
[static] Shortcut for WeaveAPI.SessionManager.newLinkableChild() and WeaveAPI.SessionManager.registerLinkableChild() except the child will not be included in the session state.
Weave
  
registerAsyncClass(type:Class, instanceHandler:Function):void
[static] Registers a class that must be instantiated asynchronously.
Weave
  
registerClass(definition:Class, qualifiedName:Object, additionalInterfaces:Array = null, displayName:String = null):void
[static] Registers an ILinkableObject class for use with Weave.className() and Weave.getDefinition().
Weave
  
removeObject(path:Array):void
Removes an object at the given path.
Weave
  
requestObject(path:Array, type:Class):ILinkableObject
Requests that an object be created if it doesn't already exist at the given path.
Weave
  
setClassInfo(definition:Class, info:Object):Object
[static] Registers a class.
Weave
  
setState(linkableObject:ILinkableObject, newState:Object, removeMissingDynamicObjects:Boolean = true):void
[static] Shortcut for WeaveAPI.SessionManager.setSessionState()
Weave
  
stringify(value:*, replacer:Function = null, indent:* = null, json_values_only:Boolean = false):String
[static] Generates a deterministic JSON-like representation of an object, meaning object keys appear in sorted order.
Weave
  
[static] Shortcut for WeaveAPI.SessionManager.unlinkSessionState()
Weave
  
wasDisposed(object:Object):Boolean
[static] Shortcut for WeaveAPI.SessionManager.objectWasDisposed()
Weave
Public Constants
 ConstantDefined By
  FRAME_INTERVAL : Number = 33.333333333333336
[static]
Weave
  HISTORY_SYNC_DELAY : int = 100
[static]
Weave
Property Detail
betaproperty
public static var beta:Boolean = false

historyproperty 
public var history:SessionStateLog

The session history

rootproperty 
public var root:ILinkableHashMap

The root object in the session state

Constructor Detail
Weave()Constructor
public function Weave()



Method Detail
AS()method
public static function AS(object:Object, type:Class):*

Parameters

object:Object
 
type:Class

Returns
* — (object as type)
classInfo()method 
public static function classInfo(info:Object):Function

Decorator-generator for registering a class.

Parameters

info:Object — An object containing the class info.

Returns
Function — A function which takes a definition and applies the supplied info.
className()method 
public static function className(def:Object):String

Gets the qualified class name from a class definition or an object instance.

Parameters

def:Object

Returns
String
combineDiff()method 
public static function combineDiff(baseDiff:Object, diffToAdd:Object):Object

Shortcut for WeaveAPI.SessionManager.combineDiff()

Parameters

baseDiff:Object
 
diffToAdd:Object

Returns
Object
computeDiff()method 
public static function computeDiff(oldState:Object, newState:Object):Object

Shortcut for WeaveAPI.SessionManager.computeDiff()

Parameters

oldState:Object
 
newState:Object

Returns
Object
copyState()method 
public static function copyState(source:ILinkableObject, destination:ILinkableObject):void

Shortcut for WeaveAPI.SessionManager.copySessionState()

Parameters

source:ILinkableObject
 
destination:ILinkableObject

detectChange()method 
public static function detectChange(observer:Object, linkableObject:ILinkableObject, ... moreLinkableObjects):Boolean

This function is used to detect if callbacks of a linkable object were triggered since the last time this function was called with the same parameters, likely by the observer. Note that once this function returns true, subsequent calls will return false until the callbacks are triggered again. It's a good idea to specify a private object or function as the observer so no other code can call detectChange with the same observer and linkableObject parameters.

Parameters

observer:Object — The object that is observing the change.
 
linkableObject:ILinkableObject — The object that is being observed.
 
... moreLinkableObjects — More objects that are being observed.

Returns
Boolean — A value of true if the callbacks for any of the objects have triggered since the last time this function was called with the same observer for any of the specified linkable objects.
disposableChild()method 
public static function disposableChild(disposableParent:Object, disposableChildOrType:Object):*

Shortcut for WeaveAPI.SessionManager.newDisposableChild() and WeaveAPI.SessionManager.registerDisposableChild()

Parameters

disposableParent:Object
 
disposableChildOrType:Object

Returns
*

See also

weave.api.core.ISessionManager.newDisposableChild()
weave.api.core.ISessionManager.registerDisposableChild()
dispose()method 
public function dispose():void

dispose()method 
public static function dispose(object:Object):void

Shortcut for WeaveAPI.SessionManager.disposeObject()

Parameters

object:Object

findPath()method 
public static function findPath(root:ILinkableObject, descendant:ILinkableObject):Array

Shortcut for WeaveAPI.SessionManager.getPath()

Parameters

root:ILinkableObject
 
descendant:ILinkableObject

Returns
Array
followPath()method 
public static function followPath(root:ILinkableObject, path:Array):ILinkableObject

Shortcut for WeaveAPI.SessionManager.getObject()

Parameters

root:ILinkableObject
 
path:Array

Returns
ILinkableObject
getAncestor()method 
public static function getAncestor(descendant:ILinkableObject, ancestorType:Class):ILinkableObject

Finds the closest ancestor of a descendant given the ancestor type.

Parameters

descendant:ILinkableObject — An object with ancestors.
 
ancestorType:Class — The Class definition used to determine which ancestor to return.

Returns
ILinkableObject — The closest ancestor of the given type.

See also

weave.api.core.ISessionManager.getLinkableOwner()
getAsyncInstanceHandler()method 
public static function getAsyncInstanceHandler(type:Class):Function

Gets the function that was passed in to registerAsyncClass() for a given type.

Parameters

type:Class

Returns
Function
getCallbacks()method 
public static function getCallbacks(linkableObject:ILinkableObject):ICallbackCollection

Shortcut for WeaveAPI.SessionManager.getCallbackCollection()

Parameters

linkableObject:ILinkableObject

Returns
ICallbackCollection
getDefinition()method 
public static function getDefinition(name:String, throwIfNotFound:Boolean = false):*

Looks up a static definition by name.

Parameters

name:String
 
throwIfNotFound:Boolean (default = false)

Returns
*
getDescendants()method 
public static function getDescendants(object:ILinkableObject, filter:Class = null):Array

Shortcut for WeaveAPI.SessionManager.getLinkableDescendants()

Parameters

object:ILinkableObject
 
filter:Class (default = null)

Returns
Array
getObject()method 
public function getObject(... path):ILinkableObject

Gets the ILinkableObject at a specified path.

Parameters

... path — An Array (or multiple parameters) specifying the path to an object in the session state. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
ILinkableObject
getOwner()method 
public static function getOwner(child:ILinkableObject):ILinkableObject

Shortcut for WeaveAPI.SessionManager.getLinkableOwner()

Parameters

child:ILinkableObject

Returns
ILinkableObject
getPath()method 
public static function getPath(object:ILinkableObject):WeavePath

Gets a WeavePath from an ILinkableObject.

Parameters

object:ILinkableObject — An ILinkableObject.

Returns
WeavePath — A WeavePath, or null if the object is not registered with a Weave instance.
getRoot()method 
public static function getRoot(object:ILinkableObject):ILinkableHashMap

Finds the root ILinkableHashMap for a given ILinkableObject.

Parameters

object:ILinkableObject — An ILinkableObject.

Returns
ILinkableHashMap — The root ILinkableHashMap.
getState()method 
public static function getState(linkableObject:ILinkableObject):Object

Shortcut for WeaveAPI.SessionManager.getSessionState()

Parameters

linkableObject:ILinkableObject

Returns
Object
getWeave()method 
public static function getWeave(object:Object):Weave

Finds the Weave instance for a given Object.

Parameters

object:Object — An Object.

Returns
Weave — The Weave instance, or null if the object was not registered as an ancestor of any instance of Weave.
id()method 
public static function id(arg:*):*

Shortcut for DebugUtils.debugId() and DebugUtils.debugLookup()

Parameters

arg:* (default = NaN)

Returns
*
IS()method 
public static function IS(object:Object, type:Class):Boolean

Parameters

object:Object
 
type:Class

Returns
Boolean — (object is type)
isAsyncClass()method 
public static function isAsyncClass(type:Class):Boolean

Checks if a class is or extends one that was registered through registerAsyncClass().

Parameters

type:Class

Returns
Boolean
isBusy()method 
public static function isBusy(object:ILinkableObject):Boolean

Shortcut for WeaveAPI.SessionManager.linkableObjectIsBusy()

Parameters

object:ILinkableObject

Returns
Boolean
isLinkable()method 
public static function isLinkable(objectOrClass:Object):Boolean

Checks if an object or class implements ILinkableObject

Parameters

objectOrClass:Object

Returns
Boolean
lang()method 
public static function lang(text:String, ... parameters):String

This is a convenient global function for retrieving localized text. Sample syntax: Weave.lang("hello world") You can also specify a format string with parameters which will be passed to StandardLib.substitute(): Weave.lang("{0} and {1}", first, second)

Parameters

text:String — The original text or format string to translate.
 
... parameters — Parameters to be passed to StandardLib.substitute() if the text is to be treated as a format string.

Returns
String
linkableChild()method 
public static function linkableChild(linkableParent:Object, linkableChildOrType:Object, callback:Function = null, useGroupedCallback:Boolean = false):*

Shortcut for WeaveAPI.SessionManager.newLinkableChild() and WeaveAPI.SessionManager.registerLinkableChild()

Parameters

linkableParent:Object
 
linkableChildOrType:Object
 
callback:Function (default = null)
 
useGroupedCallback:Boolean (default = false)

Returns
*

See also

weave.api.core.ISessionManager.newLinkableChild()
weave.api.core.ISessionManager.registerLinkableChild()
linkState()method 
public static function linkState(primary:ILinkableObject, secondary:ILinkableObject):void

Shortcut for WeaveAPI.SessionManager.linkSessionState()

Parameters

primary:ILinkableObject
 
secondary:ILinkableObject

macro()method 
public function macro(name:String, ... params):*

For backwards compatibility, may be temporary solution

Parameters

name:String
 
... params

Returns
*
path()method 
public function path(... basePath):WeavePath

Creates a WeavePath object. WeavePath objects are immutable after they are created. This is a shortcut for "new WeavePath(weave, basePath)".

Parameters

... basePath — An optional Array (or multiple parameters) specifying the path to an object in the session state. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
WeavePath — A WeavePath object.

See also

WeavePath
privateLinkableChild()method 
public static function privateLinkableChild(linkableParent:Object, linkableChildOrType:Object, callback:Function = null, useGroupedCallback:Boolean = false):*

Shortcut for WeaveAPI.SessionManager.newLinkableChild() and WeaveAPI.SessionManager.registerLinkableChild() except the child will not be included in the session state.

Parameters

linkableParent:Object
 
linkableChildOrType:Object
 
callback:Function (default = null)
 
useGroupedCallback:Boolean (default = false)

Returns
*

See also

weave.api.core.ISessionManager.newLinkableChild()
weave.api.core.ISessionManager.registerLinkableChild()
registerAsyncClass()method 
public static function registerAsyncClass(type:Class, instanceHandler:Function):void

Registers a class that must be instantiated asynchronously. Dynamic items in the session state that extend this class will be replaced with LinkablePlaceholder objects that can be replaced with actual instances later.

Parameters

type:Class
 
instanceHandler:Function

registerClass()method 
public static function registerClass(definition:Class, qualifiedName:Object, additionalInterfaces:Array = null, displayName:String = null):void

Registers an ILinkableObject class for use with Weave.className() and Weave.getDefinition().

Parameters

definition:Class — The class definition.
 
qualifiedName:Object — Either a single String or an Array of Strings which are qualified class names under which to register the class definition.
 
additionalInterfaces:Array (default = null) — An Array of interfaces (Class objects) that the definition implements in addition to ILinkableObject.
 
displayName:String (default = null) — An optional display name for the class definition.

removeObject()method 
public function removeObject(path:Array):void

Removes an object at the given path.

Parameters

path:Array — The path

requestObject()method 
public function requestObject(path:Array, type:Class):ILinkableObject

Requests that an object be created if it doesn't already exist at the given path.

Parameters

path:Array — The path
 
type:Class — The type

Returns
ILinkableObject — Either an instance of the requested type, or null if the object could not be created or a LinkablePlaceholder was created.
setClassInfo()method 
public static function setClassInfo(definition:Class, info:Object):Object

Registers a class.

Parameters

definition:Class — The class definition.
 
info:Object — An object containing the class info.

Returns
Object — The same info object passed in as a parameter.
setState()method 
public static function setState(linkableObject:ILinkableObject, newState:Object, removeMissingDynamicObjects:Boolean = true):void

Shortcut for WeaveAPI.SessionManager.setSessionState()

Parameters

linkableObject:ILinkableObject
 
newState:Object
 
removeMissingDynamicObjects:Boolean (default = true)

stringify()method 
public static function stringify(value:*, replacer:Function = null, indent:* = null, json_values_only:Boolean = false):String

Generates a deterministic JSON-like representation of an object, meaning object keys appear in sorted order.

Parameters

value:* — The object to stringify.
 
replacer:Function (default = null) — A function like function(key:String, value::
 
indent:* (default = null) — Either a Number or a String to specify indentation of nested values
 
json_values_only:Boolean (default = false) — If this is set to true, only JSON-compatible values will be used (NaN/Infinity/undefined -> null)

Returns
String
unlinkState()method 
public static function unlinkState(first:ILinkableObject, second:ILinkableObject):void

Shortcut for WeaveAPI.SessionManager.unlinkSessionState()

Parameters

first:ILinkableObject
 
second:ILinkableObject

wasDisposed()method 
public static function wasDisposed(object:Object):Boolean

Shortcut for WeaveAPI.SessionManager.objectWasDisposed()

Parameters

object:Object

Returns
Boolean
Constant Detail
FRAME_INTERVALConstant
public static const FRAME_INTERVAL:Number = 33.333333333333336

HISTORY_SYNC_DELAYConstant 
public static const HISTORY_SYNC_DELAY:int = 100