Hemi JavaScript Framework

Hemi.wires.primitive

Description

The primitive wire service is used to connect two disparate functions together.

Class Index

static Hemi.wires.service

version 3.1.0

Static instance of PrimitiveWireImpl

Hemi.wires.serviceImpl

version 3.1.0

A primitive wire connects two functions, where the first function acts as the instigator of an action, and the second function acts as the handler for the action.

Index

Example Index

Property Index

Method Index

Examples

Wire two functions together

Demonstrate how to wire two functions together with a primitive wire.

Example Code

<script type = "text/javascript">
 
function Init(){
var _p = Hemi.wires.primitive.PrimitiveWire,w,w2,co;
	/// Create a new custom object.
	///
	co = new CObj();
	/// Wire custom object to function test
	///
	w = _p.wire(co,"testC",0,"test1");
	
	/// Invoke wire #1 connecting custom object to function test2
	/// Sending "test data" as a parameter
	///
	_p.invoke(w,["test data"]);
}
function test(){
   alert('test: ' + arguments[0]);
}
function CObj(){
	this.id = "XX";
	this.testC = function(){
		alert("TestC = " + this.id + "\n" + arguments[0]);
		return 1;
	}
}
</script>

Properties

object_config

Object API structure for storing sub structures: objects and properties.

Syntax

object = object.object_config

object_id

Unique instance identifier.

Syntax

String = object.object_id

object_type

The type of this object.

Syntax

String = object.object_type

object_version

Version of the object class.

Syntax

String = object.object_version

ready_state

Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.

Syntax

int = object.ready_state

Methods

fireWire

Causes the specified wire to be invoked.

Syntax

void fireWire( i )

Parameters

getObjectId

Returns the unique id of the object.

Syntax

i = getObjectId( )

Returns

i as String: The unique object instance id.

getObjectType

Returns the type of the object.

Syntax

t = getObjectType( )

Returns

t as String: The type of the object instance.

getObjectVersion

Returns the version of the object.

Syntax

v = getObjectVersion( )

Returns

v as String: The version of the object instance.

getPointers

Returns the objects sub structure.

Syntax

o = getPointers( )

Returns

o as object: The objects substructure.

getPrimitiveWires

Returns an array of primitive wires.

Syntax

w = getPrimitiveWires( )

Returns

w as Array: Array of primitive wire objects.

getReadyState

Returns the state of the object.

Syntax

s = getReadyState( )

Returns

s as int: The object ready state.

getStatus

Returns the properties sub structure.

Syntax

o = getStatus( )

Returns

o as object: The properties substructure.

getWire

Returns the wire object based on the specified Identifier.

Syntax

r = getWire( i )

Parameters

Returns

r as object: Returns a wire object.

invoke

Invokes a wire, causing the action-handler chain to be processed.

Syntax

r = invoke( i, a, b, z, p, m )

Parameters

Returns

r as boolean: Returns true if the chain completed successfully, false if otherwise.

sigterm

Sends termination signal to destroy object.

Syntax

void sigterm( )

wire

Creates and returns a primitive wire based on the specified parameters.

Syntax

i = wire( xp, x, yp, y, ep, e, tl )

Parameters

Returns

i as String: Returns the identifier of the primitive wire object.