From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/usb/index.html | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 files/zh-cn/web/api/usb/index.html (limited to 'files/zh-cn/web/api/usb') diff --git a/files/zh-cn/web/api/usb/index.html b/files/zh-cn/web/api/usb/index.html new file mode 100644 index 0000000000..6bc95b71f2 --- /dev/null +++ b/files/zh-cn/web/api/usb/index.html @@ -0,0 +1,53 @@ +--- +title: USB +slug: Web/API/USB +translation_of: Web/API/USB +--- +

{{SeeCompatTable}}{{APIRef("WebUSB API")}}

+ +

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

+ +

属性

+ +

None.

+ +

Event handlers

+ +
+
{{domxref("USB.onconnect")}}
+
每当连接到先前配对的设备时,调用此事件处理器。
+
{{domxref("USB.ondisconnect")}}
+
每当配对设备断开连接时,调用此事件处理器。
+
+ +

方法

+ +
+
{{domxref("USB.getDevices()")}}
+
Returns a {{jsxref("Promise")}} that resolves with an array of {{domxref("USBDevice")}} objects for paired attached devices.
+
{{domxref("USB.requestDevice()")}}
+
Returns a {{jsxref("Promise")}} that resolves with an instance of {{domxref("USBDevice")}} if the specified device is found. Calling this function triggers the user agent's pairing flow.
+
+ +

规范

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Web USB','#enumeration','USB')}}{{Spec2('Web USB')}}Initial definition.
+ +

Browser compatibility

+ + + +

{{Compat("api.USB")}}

-- cgit v1.2.3-54-g00ecf