WebAPI/WebSTK: Difference between revisions

Jump to navigation Jump to search
Line 514: Line 514:


= Examples =
= Examples =
* TODO: STK constants.
== Show STK menu ==
<pre>
mobileConnection.onstkcommand = function (command) {
  var details = command.cmdDetails;
  switch (details.typeOfCommand) {
    case STK_SET_UP_MENU:
        var menu = command.param.menu;
        // create a Menu-like UI according to 'menu'
    break;
  }
};
</pre>
== Menu Selection ==
<pre>
// 'command' is got from onstkcommand
// and assume it's a SET_UP_MENU command.
var response = new MozStkResponse(command);
response.resultCode = STK_RESULT_OK;
// 'id' is got from the chosen item identifier (menu.item[].identifier)
response.menuSelection(id);
mobileConnection.sendStkResponse(response);
</pre>
Confirmed users
266

edits

Navigation menu