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('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.

Example

oMyPlugin.command('Calendar.configure', {
 
	showAvailability: true,
	numberOfDays: 7,
	calendarHours:{
 
		interval: 3000,
		morning:{
 
			enable: true,
			openTime: '08:00',
			closeTime: '11:00'
		},
		afternoon:{
 
			enable: true,
			openTime: '11:01',
			closeTime: '14:30'
		},
		evening:{
 
			enable: true,
			openTime: '14:31',
			closeTime: '18:00'
		},
	}
}).done(function(e){
 
	// Calendar configured successfully
 
}).fail(function(e){
 
	// Calendar failed because of invalid configuration or invalid time is provided
});


Options

Option Type Description
showAvailability boolean Enable/disable calendar to update the timeslots based on the callback availability. The unavailable timeslots are greyed out.
numberOfDays number The number of days to display on calendar starting today.
calenderHours.interval number The time interval between each consecutive timeslot displayed on calendar.
calenderHours.morning.enable boolean Enable/Disable morning section in calendar.
calenderHours.morning.openTime string Morning section opening time in 'HH:MM' 24 Hr format.
calenderHours.morning.closeTime string Morning section closing time in 'HH:MM' 24 Hr format.
calenderHours.afternoon.enable boolean Enable/Disable afternoon section in calendar.
calenderHours.afternoon.openTime string Afternoon section opening time in 'HH:MM' 24 Hr format.
calenderHours.afternoon.closeTime string Afternoon section closing time in 'HH:MM' 24 Hr format.
calenderHours.evening.enable boolean Enable/Disable evening section in calendar.
calenderHours.evening.openTime string Evening section opening time in 'HH:MM' 24 Hr format.
calenderHours.evening.closeTime string Evening section closing time in 'HH:MM' 24 Hr format.


Resolutions

Status When Returns
resolved When configuration options are provided and set n/a
rejected When no configuration options are provided 'No configuration provided'
rejected When invalid time is provided in Morning opening time section 'Invalid config: morning open time'
rejected When invalid time is provided in Morning closing time section 'Invalid config: morning close time'
rejected When invalid time is provided in Afternoon opening time section 'Invalid config: afternoon open time'
rejected When invalid time is provided in Afternoon closing time section 'Invalid config: afternoon close time'
rejected When invalid time is provided in Evening opening time section 'Invalid config: evening open time'
rejected When invalid time is provided in Evening closing time section 'Invalid config: evening close time'

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 callback availability on calendar with the selected date.


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
This page was last modified on April 7, 2017, at 11:13.

Feedback

Comment on this article:

blog comments powered by Disqus