Revision as of 15:44, August 5, 2016 by Mgionet (talk | contribs) (Update with the copy of version: Draft)
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!