1. 面向开发者的 Web 技术
  2. Web API
  3. USB

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

USB

有限可用

此特性不属于基线,因为它尚未在主流浏览器中得到支持。

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

WebUSB API 接口提供了从网页查找和连接 USB 设备的属性和方法

属性

None.

Event handlers

USB.onconnect

每当连接到先前配对的设备时,调用此事件处理器。

USB.ondisconnect

每当配对设备断开连接时,调用此事件处理器。

方法

USB.getDevices()

Returns a Promise that resolves with an array of USBDevice objects for paired attached devices.

USB.requestDevice()

Returns a Promise that resolves with an instance of USBDevice if the specified device is found. Calling this function triggers the user agent's pairing flow.

规范

规范
WebUSB API
# usb

Browser compatibility

帮助改进 MDN

了解如何参与贡献

此页面最后更新于 ,由 MDN 贡献者更新。

AltStyle によって変換されたページ (->オリジナル) /