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 Accepted Values
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.


Important
The value generic places your content inside the common container style so the look and feel matches widgets. The value custom places your content inside a div container. It is then up to you to style your content.
generic, custom
title string Heading title to display on the toaster window. n/a
body string Holds text value for Generic toaster type and html string template for Custom toaster type. n/a
icon string The CSS class name for an icon. n/a
controls string Show close and minimize controls on toaster window. close, minimize, all
buttons object Define the type of buttons. n/a
buttons.type string Shows two buttons on the toaster. binary
buttons.primary string Text to be shown on primary button. n/a
buttons.secondary string Text to be shown on secondary button. n/a
immutable boolean When set to true, toaster cannot be closed by other plugins. true, false


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 September 14, 2018, at 13:24.
Comments or questions about this documentation? Contact us for support!