HIDDevice: thuộc tính vendorId
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 vendorId của giao diện HIDDevice trả về ID nhà cung cấp của thiết bị HID đang kết nối. ID này xác định nhà sản xuất thiết bị.
Giá trị
Một số nguyên. Nếu thiết bị không có ID nhà cung cấp hoặc không thể truy cập ID nhà cung cấp, giá trị này sẽ là 0.
Ví dụ
Ví dụ sau lấy danh sách thiết bị bằng HID.getDevices() và ghi giá trị vendorId ra console.
let devices = await navigator.hid.getDevices();
devices.forEach((device) => {
console.log(`HID: ${device.vendorId}`);
});
Thông số kỹ thuật
| Specification |
|---|
| WebHID API> # dom-hiddevice-vendorid> |