-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebHID API available in workers #36060
base: main
Are you sure you want to change the base?
Changes from 1 commit
138f118
9c49b35
ce14308
fc7b321
e3a94af
172bdef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: "WorkerNavigator: hid property" | ||
short-title: hid | ||
slug: Web/API/WorkerNavigator/hid | ||
page-type: web-api-instance-property | ||
status: | ||
- experimental | ||
browser-compat: api.WorkerNavigator.hid | ||
--- | ||
|
||
{{APIRef("WebHID API")}}{{SeeCompatTable}}{{SecureContext_Header}} | ||
|
||
The **`WorkerNavigator.hid`** | ||
read-only property returns an {{domxref("HID")}} object providing methods | ||
for connecting to HID devices, listing attached HID devices, and event | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. connecting to HID devices that were already granted by user. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. |
||
handlers for connected HID devices. | ||
|
||
Where a defined [Permissions Policy](/en-US/docs/Web/HTTP/Permissions_Policy) blocks WebHID usage, the `WorkerNavigator.hid` property will not be available. | ||
|
||
## Value | ||
|
||
An {{domxref("HID")}} object. | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- [WebHID API](/en-US/docs/Web/API/WebHID_API) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ _The `WorkerNavigator` interface doesn't inherit any property._ | |
- : Returns the {{domxref("GPU")}} object for the current worker context. The entry point for the {{domxref("WebGPU_API", "WebGPU API", "", "nocode")}}. | ||
- {{DOMxRef("WorkerNavigator.hardwareConcurrency")}} {{ReadOnlyInline}} | ||
- : Returns the number of logical processor cores available. | ||
- {{domxref("WorkerNavigator.hid")}} {{ReadOnlyInline}} {{Experimental_Inline}} {{SecureContext_Inline}} | ||
- : Returns an {{domxref("HID")}} object providing methods for connecting to HID devices, listing attached HID devices, and event handlers for connected HID devices. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. connecting to HID devices that were already granted by user. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added; I also changed the sentence a bit to improve the grammar generally. I ended up with:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought this was still a bit difficult structurally, and looked into it a bit, and had questions. It looks to me like It looks like the caveat ("already granted permission by the user") applies to listing devices, and does so for both the window and worker versions of the So perhaps here we could say something like:
and in the window version:
? Also, is it pronounced "hid", like "a HID" or "aych eye dee", like "an HID"? The docs are inconsistent here. FWIW I would expect the former, and the spec seems to agree. (aside, the redundancy in "HID device" aka "Human Interface Device device", is absolute nails on a chalkboard for me, but I suspect that ship has sailed.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that it's not "just" listing HID devices as web developer can connect to them once they get a HIDDevice. Maybe "communicating with HID devices user has granted access to previously". See https://developer.chrome.com/docs/capabilities/hid#open There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about this a bit, and ended up changing the text in both pages to:
I think saying it more generally like this does away with the need to nitpick about exactly what the methods are doing, and makes for a cleaner, easier-to-read sentence. I have also checked the |
||
- {{DOMxRef("WorkerNavigator.language")}} {{ReadOnlyInline}} | ||
- : Returns a string representing the preferred language of the user, usually the language of the browser UI. The `null` value is returned when this is unknown. | ||
- {{DOMxRef("WorkerNavigator.languages")}} {{ReadOnlyInline}} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requestDevice() is not available in workers as it triggers a visible user prompt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've removed it from this page in the next commit.