USBConnectionEvent: thuộc tính device
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
Thuộc tính chỉ đọc device của giao diện USBConnectionEvent trả về một đối tượng USBDevice đại diện cho thiết bị đang được kết nối hoặc ngắt kết nối.
Giá trị
Một đối tượng USBDevice.
Ví dụ
Kết nối một thiết bị USB kích hoạt sự kiện connect. USBDevice hiện tại được trả về bằng cách gọi event.device.
js
navigator.usb.addEventListener("connect", (event) => {
console.log(event.device);
});
Thông số kỹ thuật
| Specification |
|---|
| WebUSB API> # dom-usbconnectionevent-device> |