Specify live-ness of XRInputSources #608
Labels
fixed by pending PR
A PR that is in review will resolve this issue.
potential breaking change
Issues that may affect the core design structure.
Milestone
Just got done consulting with @bfgeek on the subject of whether or not
XRInputSource
s and their child attributes (such asgamepad
) should be "live" on not. That is, should anXRInputSource
that you get from thegetInputSources()
call on one frame be updates with new values on the next frame (ie: live), or should you have callgetInputSources()
again which will return a new object representing the same input source but with new data. (ie: a snapshot). This is an issue that came up during Chrome implementation work and one that ended up biting the Gamepad API pretty hard a few years back, so it's in our interest to specify it now.The general sentiment is that it's a bit weird to have live objects returned from a getter function, which is the way we currently have it. On the web platform getters typically should return snapshots, as that helps alleviate lifetime issues for the objects. If we want to represent the objects as live ones that update in-place, it's recommended that we have the accessor be an attribute rather than a method, since that helps imply that you'll be getting back the same objects with each access.
Given this, I think we need to clarify the behavior of
XRInputSource
s in one of three ways:getInputSources()
method to ainputSources
attribute and specify that the objects in the array are updated in place.getInputSources()
as a method and specify that it returns a snapshot of the input state which does not subsequently update.getInputSources()
as a method but specify that it returns a live array with big flashing red text in the spec so that nobody misses it, and also go to great pains to describe exactly how those returned values lifetime corresponds to the lifetime of the session object.I have a preference for 1, but would be fine with 2 if the rest of the working group wanted it. I will accept 3 only if you have sufficient bribe money available for immediate deposit.
The text was updated successfully, but these errors were encountered: