Caplin Trader 5.1.0

Class: module:ct-component/comms/InterComponentComms

module:ct-component/comms/InterComponentComms()

new module:ct-component/comms/InterComponentComms()

This constructor is private and must never be invoked.

A singleton that allows a module:ct-component/Component to obtain a unique communication channel identifier.

Deprecated:
  • This is deprecated now. You should use the EventHub instead of the open ajax comms.

Methods

addComponentChannelListener(oComponent, oListener)

Allows a listener to register for communication channel identifier events for a given module:ct-component/Component. A channel identifier is used to group components together to allow them to communicate with each other.

Parameters:
Name Type Description
oComponent module:ct-component/Component

the component that the listener wishes to receive communication channel events for.

oListener module:ct-component/comms/CommsChannelListener

The communication channel listener

clear()

Clears all channels and listeners from the component communications hub.

clearAllChannels()

Clears all channels, informing any listeners that the channel has been removed.

clearAllListeners()

Removes all the listeners from the component communications hub.

getComponentChannel(oComponent)

Returns the component channel of the given component

Parameters:
Name Type Description
oComponent module:ct-component/Component
Returns:

The channel id of the channel

isValidChannel(sChannelId)

Helper method that can be used to validate a channelId before attempting to subscribe or unsubscribe from that channel.

Parameters:
Name Type Description
sChannelId String

linkComponents(pComponents)

Links the given components by assigning a unique id to them

Parameters:
Name Type Description
pComponents Array

An array of module:ct-component/Components that should be assigned the same communication channel. If listeners have already registered for communication channel events for the given components then the component channel will be updated for that component and each listener informed of the change.

removeComponentChannelListener(oComponent, oCommsChannelListener)

Removes the channel listener for the given component

Parameters:
Name Type Description
oComponent module:ct-component/Component

The component that the listener belongs to

oCommsChannelListener module:ct-component/comms/CommsChannelListener

the listener to remove