diff --git a/index.html b/index.html index c75088a..4e4076e 100644 --- a/index.html +++ b/index.html @@ -1534,6 +1534,19 @@

playing. + + + [[\sequenceId]] + + + 0 + + + An {{unsigned long}} incremented for each call to + {{GamepadHapticActuator/playEffect}} or + {{GamepadHapticActuator/reset}}. + +
@@ -1577,6 +1590,8 @@

`"hidden"`, return [=a promise rejected with=] an "{{InvalidStateError}}" {{DOMException}}. +
  • Increment [=this=].{{GamepadHapticActuator/[[sequenceId]]}}. +
  • If [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} is not `null`:
      @@ -1597,8 +1612,15 @@

      type=] |type|, return [=a promise rejected with=] reason {{NotSupportedError}}. -
    1. Let {{GamepadHapticActuator/[[playingEffectPromise]]}} be [=a - new promise=]. +
    2. [=Assert=] + [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} is + `null`. +
    3. +
    4. Let [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} + be [=a new promise=]. +
    5. +
    6. Let |effectSequenceId:unsigned long| be + [=this=].{{GamepadHapticActuator/[[sequenceId]]}}.
    7. Let |playEffectTimestamp:DOMHighResTimestamp| be the [=current high resolution time=] given the |document|'s [=relevant global @@ -1609,15 +1631,12 @@

    8. [=Issue a haptic effect=] to the actuator with |type|, |params|, and the |playEffectTimestamp|.
    9. -
    10. When the effect completes, if - [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} is - not `null`, [=queue a global task=] on the [=relevant global - object=] of [=this=] using the [=gamepad task source=] to run - the following steps: +
    11. When the effect completes, [=queue a global task=] on the + [=relevant global object=] of [=this=] using the [=gamepad task + source=] to run the following steps:
        -
      1. If - [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} - is `null`, abort these steps. +
      2. If [=this=].{{GamepadHapticActuator/[[sequenceId]]}} is + not |effectSequenceId|, abort these steps.
      3. [=Resolve=] [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} @@ -1631,7 +1650,8 @@

    12. -
    13. Return {{GamepadHapticActuator/[[playingEffectPromise]]}}. +
    14. Return + [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}.
    @@ -1651,37 +1671,59 @@

    `"hidden"`, return [=a promise rejected with=] an "{{InvalidStateError}}" {{DOMException}}.

  • -
  • Let |resetResultPromise:Promise| be [=a new promise=]. +
  • Increment [=this=].{{GamepadHapticActuator/[[sequenceId]]}}.
  • If [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} - is not `null`, do the following steps [=in parallel=]: + is not `null`:
    1. Let |effectPromise| be [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}.
    2. +
    3. Set + [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} to + `null`. +
    4. +
    5. [=Queue a global task=] on the [=relevant global object=] + of [=this=] using the [=gamepad task source=] to [=resolve=] + |effectPromise| with {{GamepadHapticsResult/"preempted"}}. +
    6. +
    +
  • +
  • [=Assert=] + [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} is + `null`. +
  • +
  • Let [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} + be [=a new promise=]. +
  • +
  • Let |resetSequenceId:unsigned long| be + [=this=].{{GamepadHapticActuator/[[sequenceId]]}}. +
  • +
  • Do the following steps [=in parallel=]: +
    1. [=Stop haptic effects=] on [=this=]'s gamepad's actuator.
    2. -
    3. If the effect has been successfully stopped, do: +
    4. If the effect has been successfully stopped, [=queue a + global task=] on the [=relevant global object=] of [=this=] + using the [=gamepad task source=] to run the following steps:
        -
      1. If |effectPromise| and +
      2. If [=this=].{{GamepadHapticActuator/[[sequenceId]]}} is + not |resetSequenceId|, abort these steps. +
      3. +
      4. [=Resolve=] [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} - are still the same, set + with {{GamepadHapticsResult/"complete"}}. +
      5. +
      6. Set [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} to `null`.
      7. -
      8. [=Queue a global task=] on the [=relevant global - object=] of [=this=] using the [=gamepad task source=] to - [=resolve=] |effectPromise| with - {{GamepadHapticsResult/"preempted"}}. -
    5. -
    6. [=Resolve=] |resetResultPromise| with - {{GamepadHapticsResult/"complete"}} -
  • -
  • Return |resetResultPromise|. +
  • Return + [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}.