Input Port API: Difference between revisions

Jump to navigation Jump to search
sync with current design
(→‎HDMI/DisplayPort: sync with current design)
(sync with current design)
Line 65: Line 65:
This will be an object in <code>window.navigator</code> named <code>InputPortManager</code> with the following interface:
This will be an object in <code>window.navigator</code> named <code>InputPortManager</code> with the following interface:


  [AvailableIn=CertifiedApps]
   partial interface Navigator {
   partial interface Navigator {
    [Throws, Pref="dom.inputport.enabled", CheckPermissions="inputport", AvailableIn=CertifiedApps]
     readonly attribute InputPortManager inputPortManager;
     readonly attribute InputPortManager inputPortManager;
   };
   };


  [Pref="dom.inputport.enabled", CheckPermissions="inputport", AvailableIn=CertifiedApps]
   interface InputPortManager {
   interface InputPortManager {
     Promise<sequence<InputPort>> getInputPorts ();
    [Throws]
     Promise<sequence<InputPort>> getInputPorts();
   };
   };


Line 78: Line 80:


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

edits

Navigation menu