Re: [w3c/gamepad] IDL array[]s no longer exist (#28)

> but I'm not entirely sure there needs to be prose saying the values (or at least Gamepad#buttons and Gamepad#hapticActuators) should also be cached. 

I'm not sure what you mean here.  Do you mean the value of the `buttons` property or the values in the `buttons` array?

That is, are you talking about whether `gamepad.buttons === gamepad.buttons` tests true, or about `gamepad.buttons[0]`?

Anyway, my take on how this should work is this:

1.  The object should have an internal slot storing a FrozenArray.
2.  The getter should return the value in that slot.
3.  When the set of buttons or whatnot changes, a new FrozenArray is created and stored in the slot.

This will all need to be specified in prose.  Whether in step 3 the new FrozenArray uses the same GamepadButton objects as the old one or creates new ones, I don't have a strong view on.  That's an API design decision, basically.  It's not even clear to me whether the set of buttons _can_ change.  

> Using FrozenArrays is a somewhat-breaking change though

Breaking from which point of view?  Spec or implementation?  Gecko has been shipping frozen arrays here since https://bugzilla.mozilla.org/show_bug.cgi?id=949682 was fixed back in Firefox 29.  I can't tell from code inspection what Blink does.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/issues/28#issuecomment-315392172

Received on Friday, 14 July 2017 15:40:33 UTC