aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/usb/getdevices
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/web/api/usb/getdevices
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/ru/web/api/usb/getdevices')
-rw-r--r--files/ru/web/api/usb/getdevices/index.html63
1 files changed, 63 insertions, 0 deletions
diff --git a/files/ru/web/api/usb/getdevices/index.html b/files/ru/web/api/usb/getdevices/index.html
new file mode 100644
index 0000000000..8b69fce817
--- /dev/null
+++ b/files/ru/web/api/usb/getdevices/index.html
@@ -0,0 +1,63 @@
+---
+title: USB.getDevices()
+slug: Web/API/USB/getDevices
+tags:
+ - API
+ - Method
+ - Reference
+ - USB
+ - WebUSB
+ - WebUSB API
+ - getDevices()
+translation_of: Web/API/USB/getDevices
+---
+<p>{{APIRef("WebUSB API")}}{{SeeCompatTable}}{{securecontext_header}}</p>
+
+<p>Метод<strong> <code>getDevices</code> </strong>интерфейса {{DOMxRef("USB")}} возвращает {{JSxRef("Promise")}}, который разрешается с массивом {{DOMxRef("USBDevice")}} объектов сопряжённых подключённых устройств. Для информации о сопряжённых устройствах, смотрите {{DOMxRef("USB.requestDevice()")}}.</p>
+
+<h2 id="Синтаксис">Синтаксис</h2>
+
+<pre class="syntaxbox notranslate"><em>USB</em>.getDevices()</pre>
+
+<h3 id="Параметры">Параметры</h3>
+
+<p>Нет.</p>
+
+<h3 id="Возвращаемое_значение">Возвращаемое значение</h3>
+
+<p>{{JSxRef("Promise")}}, который разрешается с массивом объектов {{DOMxRef("USBDevice")}}.</p>
+
+<h2 id="Пример">Пример</h2>
+
+<p>В следующем примере имена продуктов и серийные номера сопряжённых устройств выводятся в консоль. Для информации о сопряжённых устройствах, смотрите {{DOMxRef("USB.requestDevice","USB.requestDevice()")}}.</p>
+
+<pre class="brush: js notranslate">navigator.usb.getDevices()
+.then(devices =&gt; {
+  console.log("Total devices: " + devices.length);
+  devices.forEach(device =&gt; {
+    console.log("Product name: " + device.productName + ", serial number " + device.serialNumber);
+  });
+});</pre>
+
+<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","#dom-usb-getdevices","getDevices")}}</td>
+ <td>{{Spec2("Web USB")}}</td>
+ <td>Изначальное определение.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Совместимость_с_браузерами">Совместимость с браузерами</h2>
+
+
+
+<p>{{Compat("api.USB.getDevices")}}</p>