Mixin: ChainReactor

ChainReactor

The chain reactor mixin, provides methods to the target object that allow chain reaction events to propagate to the target and be handled, processed and passed on down the chain.
Source:

Methods

(static) chain(obj)

Creates a chain link between the current reactor node and the passed reactor node. Chain packets that are send by this reactor node will then be propagated to the passed node for subsequent packets.
Parameters:
Name Type Description
obj * The chain reactor node to link to.
Source:

(static) chainEnabled(val) → {*}

Gets / sets the flag that will enable / disable chain reactor sending from this instance. Chain reactor sending is enabled by default on all instances.
Parameters:
Name Type Description
val Boolean True or false to enable or disable chain sending.
Source:
Returns:
Type
*

(static) chainReceive(sender, type, data, optionsopt)

Handles receiving a chain reactor message that was sent via the chainSend() method. Creates the chain packet object and then allows it to be processed.
Parameters:
Name Type Attributes Description
sender Object The node that is sending the packet.
type String The type of packet.
data Object The data related to the packet.
options Object <optional>
An options object.
Source:

(static) chainSend(type, data, optionsopt)

Sends a chain reactor packet downstream from this node to any of its chained targets that were linked to this node via a call to chain().
Parameters:
Name Type Attributes Description
type String The type of chain reactor packet to send. This can be any string but the receiving reactor nodes will not react to it unless they recognise the string. Built-in strings include: "insert", "update", "remove", "setData" and "debug".
data Object A data object that usually contains a key called "dataSet" which is an array of items to work on, and can contain other custom keys that help describe the operation.
options Object <optional>
An options object. Can also contain custom key/value pairs that your custom chain reactor code can operate on.
Source:

(static) chainWillSend() → {Boolean}

Determines if this chain reactor node has any listeners downstream.
Source:
Returns:
True if there are nodes downstream of this node.
Type
Boolean

(static) unChain(obj)

Removes a chain link between the current reactor node and the passed reactor node. Chain packets sent from this reactor node will no longer be received by the passed node.
Parameters:
Name Type Description
obj * The chain reactor node to unlink from.
Source: