Contents
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('Overlay.close');
open
Opens the provided HTML in an Overlay View. When successful, it returns back the HTML and a custom close event for you to subscribe to. This alerts you when your overlay instance has been closed. You can also make your overlay immutable so that new overlay instances don't close yours. Only your widget can close its overlay when immutable is set to true.
Example
oMyPlugin.command('Overlay.open', {
html: '<div>Template</div>',
immutable: false,
group: false
}).done(function(e){
// Overlay opens successfully
}).fail(function(e){
// Overlay failed to open
});
Options
Option | Type | Description |
---|---|---|
html | string | HTML String template for overlay window. |
immutable | boolean | When set to true, overlay cannot be closed by other plugins. |
group | string | When set to true, overlay cannot be closed by other plugins. |
Resolutions
Status | When | Returns |
---|---|---|
resolved | When overlay is successfully opened | {html: <template>, events: <Object>, group: <String>} |
rejected | When no html template is passed | 'No HTML content was provided. Overlay has ignored your command.' |
rejected | When overlay is already opened | 'Overlay view is currently reserved.' |
close
Closes the Overlay UI. Publishes the appropriate custom close event for current overlay being closed.
Example
oMyPlugin.command('Overlay.close').done(function(e){
// Overlay closed successfully
}).fail(function(e){
// Overlay failed to close
});
Resolutions
Status | When | Returns |
---|---|---|
resolved | When Overlay is successfully closed. | n/a |
rejected | When Overlay is already closed. | 'Overlay view is already closed' |
rejected | When Overlay view is immutable. | 'Overlay view is currently reserved' |
This page was last edited on April 7, 2017, at 18:13.
Comments or questions about this documentation? Contact us for support!