Re: [w3c/gamepad] spec vibrationActuator gamepad extension (#68)

reillyeon commented on this pull request.



>            </p>
           <p>
-            Repeated calls to <code>pulse()</code> override the previous
-            values.
+            If the effect parameters are invalid, <code>playEffect()</code>
+            must return with a Promise resolved to
+            <code>'invalid-parameter'</code>. The validity of the effect
+            parameters is defined by the effect type.
+          </p>
+          <p>
+            If the effect type is not compatible with the actuator,
+            <code>playEffect()</code> must immediately return a Promise resolved

The use of the word "immediately" seems to imply that if I execute the following,

```
actuator.playEffect(invalid_params).then(() => {
  console.log("1");
});
Promise.resolve().then(() => {
  console.log("2");
});
```

Then it is guaranteed to print,

```
1
2
```

In my experience APIs returning Promises run the steps that result in the resolution of the promise "in parallel" which means that the exact timing of when the promise resolves is not directly tied to Javascript execution and could, for example, first require a round-trip to between a renderer and browser process before the result is known.

> +        <dt><dfn>dual-rumble</dfn></dt>
+        <dd>
+          A dual-rumble effect is a fixed-length, constant-intensity vibration
+          effect intended for an actuator of type <code>'dual-rumble'</code>.
+          Dual-rumble effects are defined by four parameters.
+          <var>duration</var> sets the duration of the vibration effect in
+          milliseconds, default 0. <var>startDelay</var> sets the duration of
+          the delay after <code>playEffect()</code> is called until vibration
+          is started, default 0. During the delay interval, the actuator must
+          not vibrate. To prevent abuse, the user agent should consider an
+          effect invalid if the total effect duration (the sum of the vibration
+          interval and delay interval) exceeds some reasonable value, say 5
+          seconds. <var>strongMagnitude</var> and <var>weakMagnitude</var> set
+          the vibration intensity levels for the heavier and lighter ERM
+          motors, normalized to the range <code>[0,1]</code>, default 0.
+        </dd>

Is it valid for any of these parameters to be 0?

-- 
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/68#pullrequestreview-99448396

Received on Monday, 26 February 2018 20:21:13 UTC