Re: [gamepad] Only 4 Controllers?

On 12/22/16 6:17 AM, Florian Bösch wrote:
> Afaik this stems from a limitation of Windows not shared by other OS'es.
> Does Firefox behave similarly?

The Firefox behavior is as follows:

1)  There is no limit.
2)  Only entries for gamepads that are or were present are returned.
3)  If a gamepad is removed, its spot in the array becomes null.

So calling getGamepad() if there are no gamepads will return an empty 
array.  At least on Mac; I haven't tested on Windows.

Note that the length of the array _has_ to be able to be more than 4, 
because of the connection/disconnection behavior.  If I connect and then 
disconnect 5 gamepads and then connect a 6th one, the spec requires that 
an array of length 6 be returned.

That said, the spec allows the array to be arbitrarily longer than the 
actual set of gamepads, padded with null; this is indistinguishable from 
the state where gamepads used to exist at those indices and then were 
disconnected.  So the Chrome/IE behavior described of returning a 
length-4 array filled with null (not undefined) is spec-compliant.

-Boris

Received on Thursday, 22 December 2016 17:43:52 UTC