Revision as of 18:52, February 26, 2016 by Ernestog (talk | contribs) (Bus, not Console)
Jump to: navigation, search

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 allows you to invoke commands and subscribe to events. The Bus is accessible globally at this location:

window._genesys.cxwidget.bus

Let's assume the Bus is stored in a variable:

var widgetBus = window._genesys.cxwidget.bus;

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!