- From: Marcos Cáceres <notifications@github.com>
 - Date: Thu, 07 Nov 2019 20:18:06 -0800
 - To: w3c/gamepad <gamepad@noreply.github.com>
 - Cc: Subscribed <subscribed@noreply.github.com>
 - Message-ID: <w3c/gamepad/pull/123/review/313727559@github.com>
 
marcoscaceres requested changes on this pull request.
Couple of issues... the button attribute returning a new object sometimes might be a problem, so we should figure something out there. 
> @@ -209,7 +209,11 @@ <h2>
         <dfn>Gamepad</dfn> interface
       </h2>
       <p>
-        This interface defines an individual gamepad device.
+        This interface represents an individual gamepad device. A Gamepad is a
+        live object; that is, user interaction with the device will be reflected
```suggestion
        live object; that is, user interaction with the device are periodically reflected
```
> @@ -230,45 +234,75 @@ <h2>
         <dd>
           An identification string for the gamepad. This string identifies the
           brand or style of connected gamepad device. Typically, this will
-          include the USB vendor and a product ID.
+          include the USB vendor and a product ID. The ID string MUST NOT change
+          once the Gamepad object has been returned to script.
We probably don't need to say (unless this has happened in practice?): 
> The ID string MUST NOT change once the Gamepad object has been returned to script.
As nothing in the spec causes the to change.  
> +          Zero-based index of the gamepad in the {{Navigator}}. The index
+          MUST NOT change once the Gamepad object has been returned to script.
+          </p>
+          <p>
+          When the system is notified that a gamepad has been connected,
+          its index attribute MUST be assigned to the lowest index that is not
+          assigned to any currently connected gamepad, starting at zero.
+          </p>
+          <p>
+          When the system is notified that a previously connected gamepad has
+          become unavailable, the `index` attribute of other gamepads MUST NOT
+          be reassigned. However, if a gamepad is disconnected, and
+          subsequently the same or a different gamepad is connected, the
+          lowest previously used index MUST be assigned to the newly connected
+          gamepad.
+          </p>
Should we add an example for clarity? 
 1. getGamepads() returns - [pad1, pad2]
 1. pad1 disconnects 
 1. getGamepads() returns - [null, pad2]
 1. pad3 connects, event fire
 1. getGamepads() returns - [pad3, pad2]
 1 pad1 re-connects
 1. getGamepads() returns - [pad3, pad2, pad1]
>            If no data has been received from the hardware, the value of the
-          <code>timestamp</code> attribute should be the time relative to
+          <code>timestamp</code> attribute MUST be the time relative to
```suggestion
          `timestamp` attribute MUST be the time relative to
```
> -          the <a>user agent</a> needs to return different values (or values in
-          a different order).
+          axis of a directional stick.
+          </p>
+          <p>
+          When the system receives new data from a connected gamepad, a
+          microtask MUST be queued with the user interaction task source to
+          update the gamepad state. If the gamepad has the same axes in the same
+          order as the previous update, and if no axis values have changed
+          since the previous update, then the axes attribute MUST return the
+          same array object. If the number of axes has changed, or if any axis
+          value has changed, then the axis attribute MUST return a new array.
+          </p>
+          <p>
+          Once the system is notified that a previously connected gamepad has
+          been disconnected, the axes attribute MUST continue to return the
```suggestion
          been disconnected, the {{Gamepad/axes}} attribute MUST continue to return the
```
> -          MUST be returned until the <a>user agent</a> needs to return
-          different values (or values in a different order).
+          <p>
+          Array of {{GamepadButton}} objects representing the current state of
+          all buttons of the gamepad. It is RECOMMENDED that buttons appear in
+          decreasing importance such that the primary button, secondary
+          button, tertiary button, and so on appear as elements 0, 1, 2, ...
+          in the buttons array.
+          </p>
+          <p>
+          When the system receives new data from a connected gamepad, a
+          microtask MUST be queued with the user interaction task source to
+          update the gamepad state. If the gamepad has the same buttons in the
+          same order as the previous update, the buttons attribute MUST return
+          the same array object. If the number of buttons or the ordering of
+          buttons has changed, the buttons attribute MUST return a new array
Oh, this would break  JS invariant: 
```
a.foo === a.foo
```
The same array must always be returned... just the objects inside it might have changed. 
> +          <p>
+          Array of {{GamepadButton}} objects representing the current state of
+          all buttons of the gamepad. It is RECOMMENDED that buttons appear in
+          decreasing importance such that the primary button, secondary
+          button, tertiary button, and so on appear as elements 0, 1, 2, ...
+          in the buttons array.
+          </p>
+          <p>
+          When the system receives new data from a connected gamepad, a
+          microtask MUST be queued with the user interaction task source to
+          update the gamepad state. If the gamepad has the same buttons in the
+          same order as the previous update, the buttons attribute MUST return
+          the same array object. If the number of buttons or the ordering of
+          buttons has changed, the buttons attribute MUST return a new array
+          object. If a button in the new array represents the same physical
+          button as a button from the previous array, the same GamepadButton
```suggestion
          button as a button from the previous array, the same {{GamepadButton}}
```
> @@ -428,6 +499,10 @@ <h2>
           each Gamepad present at the index in the array specified by its
           {{Gamepad/index}} attribute. Array indices for which there is no
           connected Gamepad with the corresponding index should return null.
+
+          <p>
+          A new array MUST be returned for each call to getGamepads().
We can delete this and annotate getGamepads() with [`[NewObject]`](https://heycam.github.io/webidl/#NewObject). 
-- 
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/pull/123#pullrequestreview-313727559
Received on Friday, 8 November 2019 04:18:09 UTC