Revision as of 22:52, February 16, 2016 by Llannoye (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 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 saved to the var widgetBus = window._genesys.cxwidget.console; local variable.

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!