static org.cote.js
version 1.9.6
Utilities for javascript objects.
This class participates in the engine library.
Index
Example Index
- New Object: Create a new JavaScript object that conforms to the Engine for Web Applications API.
- Object Prototype: This example shows the prototype of an object created with newInstance or modified with prepareObject, and identifies the properties and methods that are created.
- Prepare Existing Object: Prepare an existing JavaScript object for use with Engine for Web Applications.
Object Index
- public EngineObject: API definition for any object that may interoperate with Engine, principally the Object Registry.
Property Index
Method Index
- private _forName (internal): Creates a specific internal object.
- private _get_gunid (internal): Returns a locally unique id.
- private _implements: Implements a specified feature.
- public GetSpecifiedAttribute: Returns the value of an attribute if it was specified and the length is greater than zero.
- public gnbid: Returns a low impact unique id.
- public guid: Returns a unique id.
- public hashlight: Returns a simple hash of the specified value
- public IsAttributeSet: Tests whether an attribute has been set.
- private merge: Merges an internal object into the specified.
- public newObject: Creates and optionally registers a new object ready for use within the Engine for Web Applications framework. The new object, like most other framework objects, implements base_object and exposes the following methods: getObjectVersion, getObjectType, getObjectId, getReadyState, getPointers, and getStatus. This method invokes prepareObject, so there is no need to invoke both newObject and then invoke prepareObject.
- public prepareObject: Prepares and optionally registers a new object ready for use within the Engine for Web Applications framework. The new object, like most other framework objects, implements base_object and exposes the following methods: getObjectVersion, getObjectType, getObjectId, getReadyState, getPointers, and getStatus.
Examples
New Object
Create a new JavaScript object that conforms to the Engine for Web Applications API.
Example Code
// Don't automatically add to registry
var oNewObject = org.cote.js.newObject("DemoType","1.0", false);
// Manually add new object to registry
org.cote.js.registry.ObjectRegistry.addObject(oNewObject);
// Automatically add to registry
var oNewObject2 = org.cote.js.newObject("DemoType","1.0",true);Object Prototype
This example shows the prototype of an object created with newInstance or modified with prepareObject, and identifies the properties and methods that are created.
Example Code
var oObject = {
object_type:"specified",
object_id:"guid",
ready_state:0,
object_config:{
pointers:{
},
status:{
}
},
getObjectId:function(){return this.object_id;},
getObjectType:function(){return this.object_type;},
getObjectVersion:function(){return this.object_version;},
getReadyState:function(){return this.ready_state;},
getStatus:function(){return this.object_config.status;},
getPointers:function(){return this.object_config.pointers;}
}Prepare Existing Object
Prepare an existing JavaScript object for use with Engine for Web Applications.
Example Code
function MyObject(){
this.custom_property = "some value";
}
MyObject.prototype.CustomFunction = function(){
};
var oObject = new MyObject();
org.cote.js.prepareObject("DemoType","1.0",true,oObject);Objects
EngineObject
API definition for any object that may interoperate with Engine, principally the Object Registry.
Properties
- object_id as String: A globally unique identifier.
- object_type as String: The named type of the object.
- object_version as String: The version of the object.
- ready_state as int: State tracking mechanism, used primarily for determining object availability and destruction.
- object_config as object: Object on which the inner status and pointers objects are defined.
Methods
- String = getObjectId(
)
- String = getObjectType(
)
- String = getObjectVersion(
)
- object = getPointers(
)
- int = getReadyState(
)
- object = getStatus(
)
Properties
class_imports
Merge definitions. Property is private and should not be directly referenced.
Syntax
array = org.cote.js.class_imports
object_version
Version of this object.
Syntax
String = org.cote.js.object_version
Methods
_forName
Creates a specific internal object. Method is private and should not be directly referenced.
Syntax
o = _forName(
s
)
Parameters
- s as String : Name of the object to return.
Returns
o as object: Object based on the specified name.
_get_gunid
Returns a locally unique id. Method is private and should not be directly referenced.
Syntax
i = _get_gunid(
)
Returns
i as String: A locally unique id.
_implements
Implements a specified feature. Method is private and should not be directly referenced.
Syntax
void _implements(
o, n, v
)
Parameters
- o as object : Target object to merge features..
- n as String : Name of merge features.
- v as variant : Overloaded variant arguments to pass to the implementing object constructor.
GetSpecifiedAttribute
Returns the value of an attribute if it was specified and the length is greater than zero.
Syntax
v = GetSpecifiedAttribute(
o, n
)
Parameters
- o as Node : Node reference
- n as String : Name of the attribute to test.
Returns
v as String: Value of the attribute.
gnbid
Returns a low impact unique id.
Syntax
i = gnbid(
)
Returns
i as String: A simplified unique id.
guid
Returns a unique id.
Syntax
i = guid(
)
Returns
i as String: A unique id.
hashlight
Returns a simple hash of the specified value
Syntax
h = hashlight(
s
)
Parameters
- s as String : Value to be hashed.
Returns
h as String: A hash of the specified value.
IsAttributeSet
Tests whether an attribute has been set.
Syntax
b = IsAttributeSet(
o, n, b
)
Parameters
- o as Node : Node reference
- n as String : Name of the attribute to test.
- b as bit (optional): Bit indicating whether to return the attribute value instead of a positive bit.
Returns
b as bit: A bit indicating whether the specified attribute was set.
merge
Merges an internal object into the specified. Method is private and should not be directly referenced.
Syntax
h = merge(
o, n, s
)
Parameters
- o as object : Target object to merge features..
- n as String : Name of merge features.
- s as String : String representing merge features.
Returns
h as String: A hash of the specified value.
newObject
Creates and optionally registers a new object ready for use within the Engine for Web Applications framework. The new object, like most other framework objects, implements base_object and exposes the following methods: getObjectVersion, getObjectType, getObjectId, getReadyState, getPointers, and getStatus. This method invokes prepareObject, so there is no need to invoke both newObject and then invoke prepareObject.
Syntax
o = newObject(
t, v, r
)
Parameters
- t as String : The type of the object.
- v as String : The version of the object.
- r as boolean : Bit indicating whether the object should be registered with the Object Registry.
Returns
o as object: The new framework object.
prepareObject
Prepares and optionally registers a new object ready for use within the Engine for Web Applications framework. The new object, like most other framework objects, implements base_object and exposes the following methods: getObjectVersion, getObjectType, getObjectId, getReadyState, getPointers, and getStatus.
Syntax
void prepareObject(
t, v, r, o
)
Parameters
- t as String : The type of the object.
- v as String : The version of the object.
- r as boolean : Bit indicating whether the object should be registered with the Object Registry.
- o as object : The object to be prepared for use in the Engine for Web Applications framework.