Jump to: navigation, search
(Created target blank page For Version: PSAAS:Julie)
 
(Update with the copy of version: Public)
Line 1: Line 1:
<!-- Creation of the target page -->
+
= 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.
 +
 
 +
{{NoteFormat|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 [[GWCBusExtensions|Widgets Extensions]] for more information about extending Genesys Widgets.|1}}
 +
 
 +
 
 +
<source lang='javascript'>var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');
 +
 
 +
oMyPlugin.command('Toaster.close');</source>
 +
 
 +
== open ==
 +
Opens the Toaster UI.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
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
 +
});
 +
</source>
 +
 
 +
<br />
 +
 
 +
[[Category:V:GWC:Draft]]
 +
 
 +
=== 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.
 +
|-
 +
|}
 +
<br />
 +
=== 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.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('Toaster.close').done(function(e){
 +
 
 +
// Toaster closed successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// Toaster failed to close
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== 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'
 +
|-
 +
|}
 +
 
 +
[[Category:V:PSAAS:Julie]]

Revision as of 16:59, June 7, 2019

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'
Comments or questions about this documentation? Contact us for support!