Class: Communicator

modules/Communicator.Communicator(messageProxy)

Manages sending and receiving events to and from the message proxy. Delegates document click event handling to methods. Event delegatee methods should be defined using arrow function syntax to ensure that this will not be affected by execution context.

Constructor

new Communicator(messageProxy)

Sets the class message proxy, then adds a document click event listener that checks for a callable property of self matching the delegatee method naming format. If found, the method is called and provided with the event.

Parameters:
Name Type Description
messageProxy Proxy

The application message proxy.

Source:

Members

domElements :Object.<string, Element>

The key is a DOM element id attribute. The value is an instance of an Element for that DOM element.

Type:
  • Object.<string, Element>
Source:

name :string

static

The name of the class for use in representing the object as a string.

Type:
  • string
Source:

name :string

instance

The name of the class for use in representing an instance of the object as a string.

Type:
  • string
Source:

state :Object

Various class properties necessary for the behavior of reactive components.

Type:
  • Object
Source:

Methods

constructEventMethodName(element) → {string}

Formats a method name from the provided DOM element.

Parameters:
Name Type Description
element Element

An DOM element instance.

Source:
Returns:

A formatted string represented a method name.

Type
string

constructReceiveMethodName(property) → {string}

Formats a method name from the provided property name.

Parameters:
Name Type Description
property string

The name of the property

Source:
Returns:

A formatted string representing a method name.

Type
string

receive(object, property, value)

Sets the state for the provided object and property to the provided value when the message proxy send setter is trapped, then, if an appropriately named method exists, calls that method.

Parameters:
Name Type Description
object Object

The sender.

property string

The name of the property of the seconder sender which to store the state.

value number | string | boolean | Object

The value to set for the provided property name.

Source:

send(property, value)

Invokes the message proxy send setter.

Parameters:
Name Type Description
property string

The name of the property.

value number | string | boolean | Object

The value to set for the provided property name.

Source:

toString()

Prints the class name when an instance of the object is presented as a string.

Source:

(static) toString()

Prints the class name when the object is presented as a string.

Source: