onToolbarInteractionCommandメソッド
リスナーを「サービス・センター」に登録して、対話制御機能を提供します。 これは、初期化中に一度呼び出す必要があります。 エグゼキュータ関数は、interactionCommandPrototypeオブジェクトとともに使用されます。
interactionCommandPrototypeオブジェクトには次の属性があります:
属性 |
説明 |
---|---|
eventId |
newCommEvent中にツールバーによって提供される一意のメディア・アイテム識別子。 |
コマンド |
実行するコマンドの名前。 次のコマンドを使用できます:
|
スロット |
newCommEvent中にツールバーによって提供されるオプションのツールバー識別子。 |
inData |
コマンド・パラメータの名前と値のペアを含むオブジェクト。 |
result |
コマンド・プロセスが正常に完了すると、ツールバーによって移入されます。 失敗した場合は、理由が表示されます。 |
resultDisplayString |
ユーザーに表示され、コマンドの場合はツールバーによって移入されるエラー |
アウト・データ |
コマンドで出力データが必要な場合は、ツールバーによって入力されます。 |
sendResponse |
コマンド処理の完了時に使用されるコールバック関数。 sendResponseメソッドは、結果が移入された状態でコマンド・オブジェクトに渡される必要があります。 また、outDataおよびresultDisplayString属性は、必要に応じて移入する必要があります。 |
次に、メソッドを呼び出すためのサンプル・コードを示します:
<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>