WICG / webhid

Web API for accessing Human Interface Devices (HID)
Other
140 stars 35 forks source link

Lifecycle of event handlers #31

Open jraoult opened 4 years ago

jraoult commented 4 years ago

I managed to experiment with WebHID a few month back in Chrome. I found an issue and reported (but got no feedback, cf. https://bugs.chromium.org/p/chromium/issues/detail?id=890096#c51) about the garbage collection of the event handlers. It is very similar to an issue that plagued the (now deprecated) audio processor API as I mentioned in the issue. I ended implementing this to solve the problem: https://github.com/asutherland/ni-controllers-lib/blob/f698d54bb1f33c0a8b7b55a92c13da8ceff3ce31/lib/usb/web.ts#L44-L51

I understand this is the issue tracker for the spec. My point is there is nothing about the lifecycle/reference type held to the handler so I wonder if it should be explicitly put in the spec to avoid interpretation?

reillyeon commented 2 years ago

This issue was fixed in Chromium as crbug/1156239. @nondebug, I don't know what the best way to specify the ActiveScriptWrappable behavior in the specification. But we can probably close this issue.