<source><name>Hemi.wires</name>
/ <project><name>Hemi JavaScript Framework</name><url-title>Hemi JavaScript Framework</url-title><url>/Hemi/</url></project><package><path>Hemi.wires</path><library>Hemi</library><description>The Wire Service is used to chain multiple primitive wires (which connect disparate functions).</description><static-class><name>service</name><version>3.1.9</version><description>Static initializer for new Wire instances.</description><method><name>newInstance</name><return-value type="Wire" name="w">Returns a new Wire instance.</return-value><description>Creates and returns a new Wire instance.</description></method></static-class><class><name>serviceImpl</name><version>3.1.9</version><description>Service for extending PrimitiveWire utility, auto-linking PrimitiveWires together, and reusing PrimitiveWires.</description><example><name><![CDATA[Signal and slot example with wires]]></name><description><![CDATA[This demonstrates the use of wires to connect a set of functions in a loose signal and slot implementation. The demonstration uses a single wire that connects test1 to test2, test1 to testC, testC to testX, and testX to testC. The wire is invoked with an array of arguments that is passed to all wired functions. When the wire is invoked, the test1 function is invoked. test1 is wired to two handlers, test2 and testC, and both those handlers are invoked if test1 returns true, or handler execution is forced. If the wire is set to signal, the testC causes the testX handler to be invoked, because testC is also an action. When testX is invoked, it invokes testC again because that handler was used twice. The propogation stops after testC is invoked a second time because handlers can only signal a single time. ]]></description><code><![CDATA[function testWire(){]]></code><code><![CDATA[  var _w = Hemi.wires.wire,w,w2,co;]]></code><code><![CDATA[]]></code><code><![CDATA[  co = new CObj();]]></code><code><![CDATA[]]></code><code><![CDATA[  w = _w.newInstance();]]></code><code><![CDATA[]]></code><code><![CDATA[  /// Test 1 will invoke test 2]]></code><code><![CDATA[  /// This results in 2 function invocations]]></code><code><![CDATA[  ///]]></code><code><![CDATA[  w.wire(0,"test1",0,"test2");]]></code><code><![CDATA[  ]]></code><code><![CDATA[  /// With multiple handlers]]></code><code><![CDATA[  ///	Test 1 signals to both.]]></code><code><![CDATA[  ///]]></code><code><![CDATA[  w.wire(0,"test1",co,"testC");]]></code><code><![CDATA[  ]]></code><code><![CDATA[  /// AUTO SIGNAL LINK]]></code><code><![CDATA[  /// Because testC is both an action and a handler,]]></code><code><![CDATA[  ///	The first instance of the handler carries over as a signal]]></code><code><![CDATA[  /// This results in 1 function invocation of testX]]></code><code><![CDATA[  ///]]></code><code><![CDATA[  w.wire(co,"testC",0,"testX");]]></code><code><![CDATA[  /// AUTO SIGNAL LINK]]></code><code><![CDATA[  ///	Same as above, except back on testC]]></code><code><![CDATA[  ///	TestX is not invoked again because it is auto-signalling]]></code><code><![CDATA[  /// TestC is invoked again as a handler, but it will not auto-signal a second time]]></code><code><![CDATA[  ///]]></code><code><![CDATA[  w.wire(0,"testX",co,"testC");]]></code><code><![CDATA[]]></code><code><![CDATA[  /// Invoke the wire]]></code><code><![CDATA[        ///]]></code><code><![CDATA[]]></code><code><![CDATA[  w.invoke([{id:1,data:"the data"}],0,"test1");]]></code><code><![CDATA[]]></code><code><![CDATA[}]]></code><code><![CDATA[]]></code><code><![CDATA[function test1(o){]]></code><code><![CDATA[  alert('test1');]]></code><code><![CDATA[  return 1;]]></code><code><![CDATA[}]]></code><code><![CDATA[function testX(o){]]></code><code><![CDATA[  alert('testX');]]></code><code><![CDATA[}]]></code><code><![CDATA[]]></code><code><![CDATA[function test2(o){]]></code><code><![CDATA[  alert('test 2');]]></code><code><![CDATA[}]]></code><code><![CDATA[function test1_1(o){]]></code><code><![CDATA[  alert('test 1_1');]]></code><code><![CDATA[  return 1;]]></code><code><![CDATA[}]]></code><code><![CDATA[]]></code><code><![CDATA[function CObj(){]]></code><code><![CDATA[  this.id = "XX";]]></code><code><![CDATA[  this.object_id = "swc_debug_obj";]]></code><code><![CDATA[  this.testC = function(o){]]></code><code><![CDATA[  	alert("TestC = " + this.id + "\n" + arguments[0].data);]]></code><code><![CDATA[  }]]></code><code><![CDATA[}]]></code></example><property type="String" get="1" internal="1"><name>object_id</name><description>Unique instance identifier.</description></property><property type="String" get="1" internal="1"><name>object_version</name><description>Version of the object class.</description></property><property type="String" get="1" internal="1"><name>object_type</name><description>The type of this object.</description></property><property type="int" get="1" internal="1"><name>ready_state</name><description>Object load and execution state.  Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.</description></property><method><name>getObjectId</name><return-value name="i" type="String">The unique object instance id.</return-value><description>Returns the unique id of the object.</description></method><method><name>getObjectType</name><return-value name="t" type="String">The type of the object instance.</return-value><description>Returns the type of the object.</description></method><method><name>getObjectVersion</name><return-value name="v" type="String">The version of the object instance.</return-value><description>Returns the version of the object.</description></method><method><name>getReadyState</name><return-value name="s" type="int">The object ready state.</return-value><description>Returns the state of the object.</description></method><method><name>getWires</name><return-value name="w" type="Array">Array of wire objects.</return-value><description>Returns an array of wires.</description></method><method><name>getWiresHash</name><return-value name="w" type="Hash">Hash of wire identifiers.</return-value><description>Returns a hash of wire identifiers where the key is the id and the value is the index into the wires array.</description></method><method><name>sigterm</name><description>Sends termination signal to destroy object.</description></method><method><name>setCanSignal</name><param name="b" type="boolean">Bit indicating similar PrimitiveWires signal to each other.</param><description>Specifies whether the underlying PrimitiveWire objects signal to each other based on commonality between actions and handlers.</description></method><method><name>getCanSignal</name><return-value name="b" type="boolean">Bit indicating whether PrimitiveWires signal to each other.</return-value><description>Returns whether the underlying PrimitiveWire objects signal to each other based on commonality between actions and handlers.</description></method><method><name>invoke</name><param name="a" type="array">Arguments to pass to the wired functions.</param><param name="x" type="variant">String evaluation or object on which the specified wire function exists.</param><param name="f" type="String">Name of function to invoke.</param><param name="b" type="boolean">Force the wire handler to execute.</param><param name="o" type="boolean">Bit specifying only the handler should fire.</param><return-value name="v" type="variant">Returns false if unsuccessful, true otherwise.</return-value><description>Invokes a specified function that exists on the wire.</description></method><method><name>wire</name><param name="xp" type="variant">Object, or string evaluation, to which the action function is defined.</param><param name="x" type="function">The action function.</param><param name="yp" type="variant">Object, or string evaluation, to which the handler function is defined.</param><param name="y" type="function">The hander function.</param><param name="ep" type="variant">Object, or string evaluation, to which the error function is defined.</param><param name="e" type="function">The error function.</param><return-value name="i" type="String">Returns the identifier of the wire object.</return-value><description>Creates and returns a wire based on the specified parameters.  This function creates an underlying PrimitiveWire as well as creating linkage to be connected with other wires.</description></method><method><name>primitiveWire</name><param name="xp" type="variant">Object, or string evaluation, to which the action function is defined.</param><param name="x" type="function">The action function.</param><param name="yp" type="variant">Object, or string evaluation, to which the handler function is defined.</param><param name="y" type="function">The hander function.</param><param name="ep" type="variant">Object, or string evaluation, to which the error function is defined.</param><param name="e" type="function">The error function.</param><return-value name="i" type="String">Returns the identifier of the PrimitiveWire object.</return-value><description>Creates and returns a PrimiteWire based on the specified parameters.</description></method><method><name>invokePrimitive</name><param name="a" type="array" optional="1">Arguments to pass to the wired functions.</param><param name="i" type="String">Identifier of the primitive wire to invoke.</param><param name="b" type="boolean" optional="1" default="false">Bit indicating only the handler should be fired.</param><param name="z" type="boolean" optional="1" default="false">Bit indicating the handler should be skipped.</param><return-value name="r" type="boolean">Returns true if the chain completed successfully, false if otherwise.</return-value><description>Invokes a wire, causing the action-handler chain to be processed.</description></method><method><name>invokeHardWireAction</name><param name="o" type="PrimitiveWire">A PrimitiveWire object.</param><param name="i" type="String">Identifier of a wire.</param><param name="a" type="array" optional="1">Arguments to pass to the wired functions.</param><return-value name="r" type="boolean">Returns true if the chain completed successfully, false if otherwise.</return-value><description>Invokes the action of a hardened wire.</description></method><method><name>invokeHardWireHandler</name><param name="o" type="PrimitiveWire">A PrimitiveWire object.</param><param name="i" type="String">Identifier of a wire.</param><param name="a" type="array" optional="1">Arguments to pass to the wired functions.</param><return-value name="r" type="boolean">Returns true if the chain completed successfully, false if otherwise.</return-value><description>Invokes the handler of a hardened wire.</description></method><method><name>hardWire</name><param name="o" type="PrimitiveWire">A PrimitiveWire object.</param><param name="i" type="String">Identifier of a primitive wire.</param><param name="aa" type="array" optional="1">Arguments to pass to the action function.</param><param name="ha" type="array" optional="1">Arguments to pass to the handler function.</param><param name="xp" type="variant">Object, or string evaluation, to which the action function is defined.</param><param name="x" type="function">The action function.</param><param name="yp" type="variant">Object, or string evaluation, to which the handler function is defined.</param><param name="y" type="function">The hander function.</param><param name="ep" type="variant">Object, or string evaluation, to which the error function is defined.</param><param name="e" type="function">The error function.</param><param name="ea" type="array" optional="1">Arguments to pass to the error function.</param><return-value name="i" type="String">Returns the identifier of the newly created hardened wire.</return-value><description>Invokes the action of a hardened wire.</description></method></class></package><index><description>The Wire Service is used to chain multiple primitive wires (which connect disparate functions).</description><url>Hemi_api.html</url><url-title>API Index</url-title></index></source>
