Skip to content
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

Fire connect and disconnect events on HIDDevice and bubble #91

Open
reillyeon opened this issue Feb 9, 2022 · 0 comments
Open

Fire connect and disconnect events on HIDDevice and bubble #91

reillyeon opened this issue Feb 9, 2022 · 0 comments

Comments

@reillyeon
Copy link
Contributor

The connect and disconnect events are currently only fired on navigator.hid. For disconnects in particular it is useful to be able to listen for a particular device being disconnected. For the Web Serial API we did this by making SerialPort itself an EventTarget and defining a custom parent algorithm so that the events bubble to navigator.serial after being fired on the SerialPort.

We should do the same for this API. I believe such a change would be backwards compatible. The only difference is that the target attribute of the HIDConnectionEvent would be set to the value of its device attribute instead of navigator.hid.

The current workaround developers have to employ is to register an event handler and compare it against the device they are interested in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant