onToolbarInteractionCommand Method
Registers a listener with Fusion Service to provide interaction control functionality. This must be called once during initialization. The executor function is used with an interactionCommandPrototype object.
The interactionCommandPrototype object has the following attributes:
Attribute |
Description |
---|---|
eventId |
Unique media item identifier supplied by the toolbar during the newCommEvent. |
command |
Name of the command to execute. The following commands are available:
|
slot |
An optional toolbar identifier supplied by the toolbar during the newCommEvent. |
inData |
The object containing the name value pairs for the command parameters. |
result |
Populated by the toolbar after the command process has completed successfully. If there was a failure, the reason will be displayed. |
resultDisplayString |
Error displayed to the user, and populated by the toolbar if the command |
outdata |
Populated by the toolbar if the command required output data. |
sendResponse |
Callback function used upon completion of the command processing. The sendResponse method must be passed to the command object with the result populated. Also the outData and resultDisplayString attributes must be populated if required. |
The following is sample code to call the method:
<html>
<head>
<script type="text/javascript" src="http://domain:port/ora_support/js/mcaInteractionV1.js">
</script>
<script type="text/javascript">
function interactionCommandExecutor(command) {
switch(command.command)
case "accept":
alert("Received accept command");
break;
case "reject":
alert("Received reject command");
break;
case "setActive":
alert("Received setActive command");
break;
}
command.result = 'success';
command.sendResponse(command);
}
function registerInteractionCommandListener() {
svcMcaTlb.api.onToolbarInteractionCommand(interactionCommandExecutor);
}
</script>
<body>
<input type="button" value="Register interaction command listener" onclick="registerInteractionCommandListener()"/>
</body>
</html>