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}}.
- - Let {{GamepadHapticActuator/[[playingEffectPromise]]}} be [=a
- new promise=].
+
- [=Assert=]
+ [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} is
+ `null`.
+
+ - Let [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
+ be [=a new promise=].
+
+ - Let |effectSequenceId:unsigned long| be
+ [=this=].{{GamepadHapticActuator/[[sequenceId]]}}.
- Let |playEffectTimestamp:DOMHighResTimestamp| be the [=current
high resolution time=] given the |document|'s [=relevant global
@@ -1609,15 +1631,12 @@
- [=Issue a haptic effect=] to the actuator with |type|,
|params|, and the |playEffectTimestamp|.
- - 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:
+
- 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:
- - If
- [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
- is `null`, abort these steps.
+
- If [=this=].{{GamepadHapticActuator/[[sequenceId]]}} is
+ not |effectSequenceId|, abort these steps.
- [=Resolve=]
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
@@ -1631,7 +1650,8 @@
- - Return {{GamepadHapticActuator/[[playingEffectPromise]]}}.
+
- 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`:
- Let |effectPromise| be
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}.
+ - Set
+ [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} to
+ `null`.
+
+ - [=Queue a global task=] on the [=relevant global object=]
+ of [=this=] using the [=gamepad task source=] to [=resolve=]
+ |effectPromise| with {{GamepadHapticsResult/"preempted"}}.
+
+
+
+ - [=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=]:
+
- [=Stop haptic effects=] on [=this=]'s gamepad's actuator.
- - If the effect has been successfully stopped, do:
+
- 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:
- - If |effectPromise| and
+
- If [=this=].{{GamepadHapticActuator/[[sequenceId]]}} is
+ not |resetSequenceId|, abort these steps.
+
+ - [=Resolve=]
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
- are still the same, set
+ with {{GamepadHapticsResult/"complete"}}.
+
+ - Set
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
to `null`.
- - [=Queue a global task=] on the [=relevant global
- object=] of [=this=] using the [=gamepad task source=] to
- [=resolve=] |effectPromise| with
- {{GamepadHapticsResult/"preempted"}}.
-
- - [=Resolve=] |resetResultPromise| with
- {{GamepadHapticsResult/"complete"}}
-
- - Return |resetResultPromise|.
+
- Return
+ [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}.