Widget Bus API Overview
The Widget Bus API comprises two components:
The Widget Bus API events and commands are executed asynchronously using deferred methods.
The Widget Bus Console allows you to invoke commands and subscribe to events. The Console is accessible globally at this location:
window._genesys.cxwidget.console
Let's assume the Console is stored in a variable:
var widgetBus = window._genesys.cxwidget.console;Example 1: Subscribing to an Event
Format: widgetBus.subscribe("event name and path", function(){})
Example:
widgetBus.subscribe("cx.plugin.WebChat.ready", function(){});Example 2: Invoking a Command
Format: widgetBus.command("command name and path", options).done(function).fail(function)
Example:
widgetBus.command("cx.plugin.WebChat.open", {}).done(function(e){
// success scenario
}).fail(function(e){
// failure scenario: error, exception, improper arguments
})
Comments or questions about this documentation? Contact us for support!
