Input Port API: Difference between revisions

Jump to navigation Jump to search
→‎Examples: fix indent
(sync with current design)
(→‎Examples: fix indent)
Line 79: Line 79:
This method makes a request to retrieve all the available input ports on a device. It returns a new Promise that will be used to notify the caller about the result of the operation, which is an array of InputPort elements belong to the InputPortManager.
This method makes a request to retrieve all the available input ports on a device. It returns a new Promise that will be used to notify the caller about the result of the operation, which is an array of InputPort elements belong to the InputPortManager.


== Examples ==
'''Bold text'''== Examples ==


var inputPortMgr = navigator.inputPortManager;
  var inputPortMgr = navigator.inputPortManager;
    inputPortMgr.getInputPorts().then(
  inputPortMgr.getInputPorts().then(
      function(aPorts) {
    function(aPorts) {
        for (var i=0; i < aPorts.length; ++i) {
      for (var i=0; i < aPorts.length; ++i) {
          var port = aPorts[i];
        var port = aPorts[i];
          if(port instanceof HDMIInputPort) {
        if(port instanceof HDMIInputPort) {
            //....
          //....
          }
        }
        }
      }
      },
    },
      function(aError) {
    function(aError) {
        //error
      //error
      }
    }
    );
  );
17

edits

Navigation menu