Macro for Webex Roomkit to Add clock on the screen (when on call as well as on call Disconnect)
I am looking for a Macro for Webex RoomKit to show clock(not the timer) on screen.
ce version :9.9.2
Script
Below is the script I have created, it doesn’t returns any error however doesn’t shows clock while on call.
Please can you help, what is missing/wrong in this code.
const xapi = require('xapi');
function Date_Time() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
clock = today + "/" + h + ":" + m + ":" + s;
xapi.command('userinterface Message Textline Display', {X: 9400, Y: 500, Text: clock});
showMsg(clock, 1000);
}
function checkTime(i) {
if (i < 10) {i = "0" + i} // add zero in front of numbers < 10
return i;
}
xapi.event.on('CallSuccessful', Date_Time);
xapi.event.on('CallDisconnect', Date_Time);
I also tried to add below function to log errors however it gives out error mentioned below
function handleError(error) { console.log('Error', error); }
xapi.event.on('CallSuccessful', Date_Time).catch(handleError);
xapi.event.on('CallDisconnect', Date_Time).catch(handleError);
Error message
17:08:36Untitled1TypeError: undefined not callable (property 'catch' of [object Function]) at [anon] (duk_js_call.c:2918) internal at global (Untitled1:36) strict preventsyield36
Regards