Re: [w3c/gamepad] extensions: Add vibrationActuator and dual-rumble effect (PR #163)

@nondebug commented on this pull request.



> +        <dt>
+          <dfn>playEffect()</dfn> method
+        </dt>
+        <dd>
+          <p>
+            The {{GamepadHapticActuator/playEffect()}} method steps are:
+          </p>
+          <ol>
+            <li>If |params:GamepadEffectParameters| does not describe a [=valid
+            effect=] of type |type:GamepadHapticEffectType|, return [=a promise
+            resolved with=] {{GamepadHapticsResult/"invalid-parameter"}}.
+            </li>
+            <li>Let |document| be the [=current settings object=]'s [=relevant
+            global object=]'s [=associated `Document`=].
+            </li>
+            <li>If |document| is `null` or |document| is not [=Document/fully

If I understand correctly this would be a new (optional) effect param and would let you do something like this:

    const controller = new AbortController();
    const playEffectPromise = gamepad.vibrationActuator.playEffect('dual-rumble', {signal:controller.signal, strongMagnitude:1.0, duration:1000});
    controller.abort(); // instead of gamepad.vibrationActuator.reset()
    const effectResult = await playEffectPromise; // resolves to 'preempted'

That sounds good to me.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/163#discussion_r967542579
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/gamepad/pull/163/review/1103001822@github.com>

Received on Friday, 9 September 2022 23:43:50 UTC