Constructor
new module:caplin/component/comms/InterComponentComms()
This constructor is private and must never be invoked.
A singleton that allows a
module:caplin/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:caplin/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:caplin/component/Component the component that the listener wishes to receive communication channel events for. oListener
module:caplin/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:caplin/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:caplin/component/Component
s 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:caplin/component/Component The component that the listener belongs to oCommsChannelListener
module:caplin/component/comms/CommsChannelListener the listener to remove