aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/usb
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/usb
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/usb')
-rw-r--r--files/zh-cn/web/api/usb/index.html53
1 files changed, 53 insertions, 0 deletions
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
+---
+<p>{{SeeCompatTable}}{{APIRef("WebUSB API")}}</p>
+
+<p><a href="/en-US/docs/Web/API/WebUSB_API">WebUSB API</a> 接口提供了从网页查找和连接USB设备的属性和方法</p>
+
+<h2 id="属性">属性</h2>
+
+<p>None.</p>
+
+<h3 id="Event_handlers">Event handlers</h3>
+
+<dl>
+ <dt>{{domxref("USB.onconnect")}}</dt>
+ <dd>每当连接到先前配对的设备时,调用此事件处理器。</dd>
+ <dt>{{domxref("USB.ondisconnect")}}</dt>
+ <dd>每当配对设备断开连接时,调用此事件处理器。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{domxref("USB.getDevices()")}}</dt>
+ <dd>Returns a {{jsxref("Promise")}} that resolves with an array of {{domxref("USBDevice")}} objects for paired attached devices.</dd>
+ <dt>{{domxref("USB.requestDevice()")}}</dt>
+ <dd>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.</dd>
+</dl>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Web USB','#enumeration','USB')}}</td>
+ <td>{{Spec2('Web USB')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.USB")}}</p>