HIDDevice: phương thức close()
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.
Phương thức close() của giao diện HIDDevice đóng kết nối đến thiết bị HID.
Cú pháp
js
close()
Tham số
Không có.
Giá trị trả về
Một Promise được giải quyết với giá trị undefined khi kết nối đã đóng.
Ví dụ
Trong ví dụ sau, chúng ta đóng thiết bị HID sau khi tất cả dữ liệu đã được gửi và nhận.
js
await device.close();
Thông số kỹ thuật
| Specification |
|---|
| WebHID API> # dom-hiddevice-close> |