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.
var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');
oMyPlugin.command('Calendar.reset');
configure
Internal use only. The main App plugin shares configuration settings to widgets using each widget’s configure command. The configure command can only be called once at startup. Calling configure again after startup may result in unpredictable behavior.
generate
Builds and generates the calendar. Should subscribe to the events to get the generated calendar and display where you would like to.
Example
oMyPlugin.command('Calendar.generate', {date: 'Mon Mar 20 2017 19:51:47 GMT-0700 (PDT)'}).done(function(e){
// Calendar generated successfully
}).fail(function(e){
// Calendar failed to generate
});
Options
Option | Type | Description |
---|---|---|
date | Date string/object | To pre-select the date and time on calendar. |
Resolutions
Status | When | Returns |
---|---|---|
resolved | When the calendar is successfully generated | n/a |
rejected | When Invalid date is passed to calendar | 'Invalid data' |
showAvailability
Update the calendar timeslots with the callback availability. This enables only those timeslots that have the callback facility and disables the remaining.
Example
oMyPlugin.command('Calendar.showAvailability', {date: '03/22/17'}).done(function(e){
// Calendar showed availability successfully
}).fail(function(e){
// Calendar failed to show availability
});
Options
Option | Type | Description |
---|---|---|
date | Date string/object | Update the available time slots in the Calendar plugin for the selected Date. Note that, after calling this command, the internal showAvailability value is set to true for this session and the Calendar only shows the available time slots when switching between other dates. |
Resolutions
Status | When | Returns |
---|---|---|
resolved | When timeslots are successfully updated | n/a |
rejected | When no date value is found to check the availability | 'No date found to check availability' |
rejected | When invalid date value is found | 'Invalid date' |
reset
Resets the calendar with no pre-selected values.
Example
oMyPlugin.command('Calendar.reset').done(function(e){
// Calendar reset successfully
}).fail(function(e){
// Calendar failed to reset
});
Resolutions
Status | When | Returns |
---|---|---|
resolved | When calendar is successfully reset | n/a |