HTTP/2 200
content-type: text/html
x-guploader-uploadid: AAwnv3LkFKh4UYOKsjSe7S7TYY5iyMgywYlpmhajOOsjxNAYoIWuZqDan1tugDn8Xl2LUiwc
cache-control: public, max-age=3600
expires: Sat, 11 Oct 2025 15:11:01 GMT
last-modified: Fri, 10 Oct 2025 01:11:00 GMT
etag: W/"3f6eb7fb5a962c9d16ff99114917af1c"
x-goog-generation: 1760058660045900
x-goog-metageneration: 1
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 159264
x-goog-meta-goog-reserved-file-mtime: 1760056915
x-goog-hash: crc32c=zlWy7g==, md5=P263+1qWLJ0W/5kRSRevHA==
x-goog-storage-class: STANDARD
accept-ranges: none
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
alt-svc: clear
referrer-policy: strict-origin-when-cross-origin
x-content-type-options: nosniff
strict-transport-security: max-age=63072000
content-security-policy: default-src 'self'; script-src 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; script-src-elem 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; style-src 'report-sample' 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self'; connect-src 'self' developer.allizom.org bcd.developer.allizom.org bcd.developer.mozilla.org updates.developer.allizom.org updates.developer.mozilla.org https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com https://incoming.telemetry.mozilla.org https://observatory-api.mdn.allizom.net https://observatory-api.mdn.mozilla.net https://api.github.com/search/issues stats.g.doubleclick.net https://api.stripe.com; font-src 'self'; frame-src 'self' interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net mdn.github.io live-samples.mdn.mozilla.net live-samples.mdn.allizom.net *.mdnplay.dev *.mdnyalp.dev *.play.test.mdn.allizom.net https://v2.scrimba.com https://scrimba.com jsfiddle.net www.youtube-nocookie.com codepen.io survey.alchemer.com https://js.stripe.com; img-src 'self' data: *.githubusercontent.com *.googleusercontent.com *.gravatar.com mozillausercontent.com firefoxusercontent.com profile.stage.mozaws.net profile.accounts.firefox.com developer.mozilla.org mdn.dev interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net wikipedia.org upload.wikimedia.org https://mdn.github.io/shared-assets/ https://mdn.dev/ https://*.google-analytics.com https://*.googletagmanager.com www.gstatic.com; manifest-src 'self'; media-src 'self' archive.org videos.cdn.mozilla.net https://mdn.github.io/shared-assets/; child-src 'self'; worker-src 'self';
x-frame-options: DENY
origin-trial: AxVILwizhbMjxFeHOn1P3R8niO1RJY/smaK4B4d1rLzc1gTaxtXMSaTi+FoigYgCw40uFRDwFcEAeqDR+vVLOW4AAABfeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb25WMiIsImV4cGlyeSI6MTc0MjA3OTYwMH0=
x-cloud-trace-context: 0ae2006b25011560d6c73d0d97fc90a3
date: Sat, 11 Oct 2025 14:11:01 GMT
server: Google Frontend
via: 1.1 google
vary: Accept-Encoding
content-encoding: gzip
x-cache: miss
HIDDevice.collections - Web API | MDN
レポート形式の配列です。各エントリーは以下を含みます。
usagePage
-
このコレクションに紐づいた HID 使用法の Usage Page 部分を表す整数です。トップレベルのコレクションの使用法は、デバイスの種類を特定するために使用されます。
標準の HID 使用法の値は、HID Usage Tables に載っています。
usage
-
このコレクションに紐づいた HID 使用法の Usage ID 部分を表す整数です。
type
-
コレクションの種類を表す 8 ビットの値です。グループ化されたアイテムの関係を表します。以下のいずれかです。
0x00
-
Physical (軸のグループ)
0x01
-
Application (マウス、キーボード)
0x02
-
Logical (関連するデータ)
0x03
-
Report
0x04
-
Named array
0x05
-
Usage switch
0x06
-
Usage modified
0x07 to 0x7F
-
将来のために予約
0x80 to 0xFF
-
ベンダー定義
これらの種類についての追加情報は、Device Class Definition に載っています。
children
-
トップレベルコレクションと同じ形式の、サブコレクションの配列です。
inputReports
-
このコレクションで記述されているそれぞれの Input レポートを表す inputReport
の配列です。
outputReports
-
このコレクションで記述されているそれぞれの Output レポートを表す outputReport
の配列です。
featureReports
-
このコレクションで記述されているそれぞれの Feature レポートを表す featureReport
の配列です。
この例は、collections
プロパティが返された後、様々な要素にアクセスする方法を示しています。他の例や動くデモを記事 Connecting to uncommon HID devices で見ることができます。
for (const collection of device.collections) {
// HID コレクションには、使用法、Usage Page、レポート、サブコレクションが含まれます。
console.log(`Usage: ${collection.usage}`);
console.log(`Usage page: ${collection.usagePage}`);
for (const inputReport of collection.inputReports) {
console.log(`Input report: ${inputReport.reportId}`);
// inputReport.items をループで走査します
}
for (const outputReport of collection.outputReports) {
console.log(`Output report: ${outputReport.reportId}`);
// outputReport.items をループで走査します
}
for (const featureReport of collection.featureReports) {
console.log(`Feature report: ${featureReport.reportId}`);
// featureReport.items をループで走査します
}
// collection.children を用いてサブコレクションをループで走査します
}