HIDDevice: thuộc tính opened
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Note: This feature is available in Web Workers, except for Shared Web Workers.
Thuộc tính chỉ đọc opened của giao diện HIDDevice trả về true nếu kết nối đến HIDDevice đang mở và sẵn sàng truyền dữ liệu.
Giá trị
Một giá trị boolean, true nếu kết nối đang mở.
Ví dụ
Ví dụ sau lấy danh sách thiết bị bằng HID.getDevices() và ghi giá trị opened ra console.
js
let devices = await navigator.hid.getDevices();
devices.forEach((device) => {
console.log(`HID: ${device.opened}`);
});
Thông số kỹ thuật
| Specification |
|---|
| WebHID API> # dom-hiddevice-opened> |