- From: Gabriel Brito <notifications@github.com>
- Date: Fri, 15 Dec 2023 16:32:40 -0800
- To: w3c/gamepad <gamepad@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/gamepad/pull/190/review/1785077292@github.com>
@gabrielsanbrito commented on this pull request.
> + |effectPromise| with {{GamepadHapticsResult/"preempted"}}.
+ </li>
+ </ol>
+ </li>
+ <li>If this actuator cannot [=play effects with type=] |type|,
+ return [=a promise rejected with=] reason {{NotSupportedError}}.
+ </li>
+ <li>Let {{GamepadHapticActuator/[[playingEffectPromise]]}} be [=a
+ new promise=].
+ </li>
+ <li>Do the following steps in parallel:
+ <ol>
+ <li>[=Issue a haptic effect=] to the actuator with |type| and
+ |params|.
+ </li>
+ <li>When the effect completes, if it was not preempted, [=queue
Thinking a little bit more about it, I think that only checking `GamepadHapticActuator/[[playingEffectPromise]]` might not be the best way to proceed. For example:
1. Effect `e1` starts playing. So `GamepadHapticActuator/[[playingEffectPromise]]` is set to `p1`
2. While `e1` is already executing (gamepad is already vibrating), we issue `e2`
3. `GamepadHapticActuator/[[playingEffectPromise]]` is set to `p2` and `p1` is resolved with `"preempted"`.
4. `e1` finishes playing normally and `GamepadHapticActuator/[[playingEffectPromise]]` is already set to `p2`. `p2` is resolved with `"completed"` and `GamepadHapticActuator/[[playingEffectPromise]]` is set to `null`.
I think that we could maybe add an explicit "stop haptics effect", like we did with `reset()`:
```
<li>If [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
is not `null`:
<ol>
<li>Let |effectPromise| be
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}.
</li>
<li>Set
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} to
`null`.
</li>
<li>[=Stop haptic effects=] on [=this=]'s gamepad's actuator.
</li>
<li>[=Queue a global task=] on the [=relevant global object=]
of [=this=] using the [=gamepad task source=] to [=resolve=]
|effectPromise| with {{GamepadHapticsResult/"preempted"}}.
</li>
</ol>
</li>
```
I think that is why the "if it was not preempted" part is also relevant. What do you think? Also @nondebug.
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/190#discussion_r1428610110
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/gamepad/pull/190/review/1785077292@github.com>
Received on Saturday, 16 December 2023 00:32:45 UTC