Namespace OWF.Eventing
Defined in: Widget.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
The OWF.Eventing object manages the eventing for an individual widget
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
OWF.Eventing.publish(channelName, message, dest)
Publishes a message to a given channel.
|
| <static> |
OWF.Eventing.subscribe(channelName, handler)
Subscribe to a named channel for a given function.
|
| <static> |
OWF.Eventing.unsubscribe(channelName)
Unsubscribe to a named channel.
|
Method Detail
<static>
OWF.Eventing.publish(channelName, message, dest)
Publishes a message to a given channel.
OWF.Eventing.publish("ClockChannel", currentTimeString);
- Parameters:
- {String} channelName
- The name of the channel to publish to
- {Object} message
- The message to publish to the channel.
- {String} dest Optional
- The id of a particular destination. Defaults to null which sends to all subscribers on the channel. See OWF.getIframeId for a description of the id.
<static>
OWF.Eventing.subscribe(channelName, handler)
Subscribe to a named channel for a given function.
OWF.Eventing.subscribe("ClockChannel", this.update);
var update = function(sender, msg, channel) {
document.getElementById('currentTime').innerHTML = msg;
}
- Parameters:
- {String} channelName
- The channel to subscribe to.
- {Function} handler
- The function you wish to subscribe. This function will be called with three arguments: sender, msg, channel.
- {String} handler.sender Optional
- The first argument passed to the handler function is the id of the sender of the message. See OWF.getIframeId for a description of this id.
- {Object} handler.msg Optional
- The second argument passed to the handler function is the message itself.
- {String} handler.channel Optional
- The third argument passed to the handler function is the channel the message was published on.
<static>
OWF.Eventing.unsubscribe(channelName)
Unsubscribe to a named channel.
OWF.Eventing.unsubscribe("ClockChannel");
- Parameters:
- {String} channelName
- The channel to unsubscribe to.