files/en-us/web/api/hiddevice/sendfeaturereport/index.md
{{securecontext_header}}{{APIRef("WebHID API")}}{{SeeCompatTable}}{{AvailableInWorkers("window_and_worker_except_shared")}}
The sendFeatureReport() method of the {{domxref("HIDDevice")}} interface sends a feature report to the HID device. Feature reports are a way for HID devices and applications to exchange non-standardized HID data.
The reportId for each of the report formats that this device supports can be retrieved from {{domxref("HIDDevice.collections")}}.
sendFeatureReport(reportId, data)
reportId
0.data
A {{jsxref("Promise")}} that resolves with undefined once the report has been sent.
NotAllowedError {{domxref("DOMException")}}
In the following example sendFeatureReport() makes a device blink. You can see more examples and live demos in the article Connecting to uncommon HID devices.
const reportId = 1;
for (let i = 0; i < 10; i++) {
// Turn off
await device.sendFeatureReport(reportId, Uint32Array.from([0, 0]));
await new Promise((resolve) => setTimeout(resolve, 100));
// Turn on
await device.sendFeatureReport(reportId, Uint32Array.from([512, 0]));
await new Promise((resolve) => setTimeout(resolve, 100));
}
{{Specifications}}
{{Compat}}