Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HIDConnectionEvent
  4. device

HIDConnectionEvent: device property

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 insecure contexts (HTTPS), in some or allsupporting browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

Note: This feature is available inWeb Workers, except forShared Web Workers.

Thedevice read-only property of theHIDConnectionEvent interface returns theHIDDevice associated with this connection event.

Value

AHIDDevice.

Examples

The following example registers event listeners forconnect anddisconnect events, then prints theHIDDevice.productName to the console.

js
navigator.hid.addEventListener("connect", ({ device }) => {  console.log(`HID connected: ${device.productName}`);});navigator.hid.addEventListener("disconnect", ({ device }) => {  console.log(`HID disconnected: ${device.productName}`);});

Specifications

Specification
WebHID API
# dom-hidconnectionevent-device

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp