Jump to: navigation, search

API Commands

Once you've registered your own plugin on the bus, you can call commands on other registered plugins. Below we'll quickly register a new plugin on the bus using the global bus object.

Important
The global bus object is a debug tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see Widgets Extensions for more information about extending Genesys Widgets.


var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');

oMyPlugin.command('Toaster.close');

open

Opens the Toaster UI.

Example

oMyPlugin.command('Toaster.open', {

	type: 'generic',
	title: 'Toaster Title',
	body: 'Toaster Body',
	icon: 'chat',
	controls: 'close',
	immutable: false,
	buttons:{

		type: 'binary',
		primary: 'Accept',
		secondary: 'Decline'
	}

}).done(function(e){

	// Toaster opened successfully

}).fail(function(e){

	// Toaster failed to open properly
});


Options

Option Type Description
type string Specifies the type of body content that can be provided to toaster window. Generic type shows the default body content and custom type overrides the default html body content.
title string Heading title to display on the toaster window.
body string Holds text value for Generic toaster type and html string template for Custom toaster type.
icon string The CSS class name for an icon.
controls string Show close and minimize controls on toaster window.
buttons object Define the type of buttons.
buttons.type string Shows two buttons on the toaster.
buttons.primary string Text to be shown on primary button.
buttons.secondary string Text to be shown on secondary button.
immutable boolean When set to true, toaster cannot be closed by other plugins.


Resolutions

Status When Returns
resolved When Toaster is successfully opened n/a
rejected When no toaster type is specified 'No content was provided. Toaster has ignored your command'
rejected When toaster is already opened 'Toaster view is currently reserved'

close

Closes the Toaster UI.

Example

oMyPlugin.command('Toaster.close').done(function(e){

	// Toaster closed successfully

}).fail(function(e){

	// Toaster failed to close
});


Resolutions

Status When Returns
resolved When toaster is successfully closed. n/a
rejected When Toaster is already closed. 'Toaster view is already closed'
rejected When Toaster view is immutable. 'Toaster view is currently reserved'
This page was last edited on July 7, 2017, at 16:09.
Comments or questions about this documentation? Contact us for support!