Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sequenceId slot and fix effect promises #201

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 67 additions & 25 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,19 @@ <h2>
playing.
</td>
</tr>
<tr>
<td>
<dfn data-dfn-for="GamepadHapticActuator">[[\sequenceId]]</dfn>
</td>
<td>
0
</td>
<td>
An {{unsigned long}} incremented for each call to
{{GamepadHapticActuator/playEffect}} or
{{GamepadHapticActuator/reset}}.
</td>
</tr>
</table>
<dl data-dfn-for="GamepadHapticActuator">
<dt>
Expand Down Expand Up @@ -1165,6 +1178,8 @@ <h2>
`"hidden"`, return [=a promise rejected with=] an
"{{InvalidStateError}}" {{DOMException}}.
</li>
<li>Increment [=this=].{{GamepadHapticActuator/[[sequenceId]]}}.
</li>
<li>If [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
is not `null`:
<ol>
Expand All @@ -1185,8 +1200,15 @@ <h2>
type=] |type|, return [=a promise rejected with=] reason
{{NotSupportedError}}.
</li>
<li>Let {{GamepadHapticActuator/[[playingEffectPromise]]}} be [=a
new promise=].
<li>[=Assert=]
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} is
`null`.
</li>
<li>Let [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
nondebug marked this conversation as resolved.
Show resolved Hide resolved
be [=a new promise=].
</li>
<li>Let |effectSequenceId:unsigned long| be
[=this=].{{GamepadHapticActuator/[[sequenceId]]}}.
</li>
<li>Let |playEffectTimestamp:DOMHighResTimestamp| be the [=current
high resolution time=] given the |document|'s [=relevant global
Expand All @@ -1197,15 +1219,12 @@ <h2>
<li>[=Issue a haptic effect=] to the actuator with |type|,
|params|, and the |playEffectTimestamp|.
</li>
<li>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:
<li>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:
<ol>
<li>If
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
is `null`, abort these steps.
<li>If [=this=].{{GamepadHapticActuator/[[sequenceId]]}} is
nondebug marked this conversation as resolved.
Show resolved Hide resolved
not |effectSequenceId|, abort these steps.
</li>
<li>[=Resolve=]
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
Expand All @@ -1219,7 +1238,8 @@ <h2>
</li>
</ol>
</li>
<li>Return {{GamepadHapticActuator/[[playingEffectPromise]]}}.
<li>Return
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}.
</li>
</ol>
</dd>
Expand All @@ -1239,37 +1259,59 @@ <h2>
`"hidden"`, return [=a promise rejected with=] an
"{{InvalidStateError}}" {{DOMException}}.
</li>
<li>Let |resetResultPromise:Promise| be [=a new promise=].
<li>Increment [=this=].{{GamepadHapticActuator/[[sequenceId]]}}.
</li>
<li>If [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
is not `null`, do the following steps [=in parallel=]:
is not `null`:
<ol>
<li>Let |effectPromise| be
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}.
</li>
<li>Set
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} to
`null`.
</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>
<li>[=Assert=]
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} is
`null`.
</li>
<li>Let [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
nondebug marked this conversation as resolved.
Show resolved Hide resolved
be [=a new promise=].
</li>
<li>Let |resetSequenceId:unsigned long| be
[=this=].{{GamepadHapticActuator/[[sequenceId]]}}.
</li>
<li>Do the following steps [=in parallel=]:
<ol>
<li>[=Stop haptic effects=] on [=this=]'s gamepad's actuator.
</li>
<li>If the effect has been successfully stopped, do:
<li>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:
<ol>
<li>If |effectPromise| and
<li>If [=this=].{{GamepadHapticActuator/[[sequenceId]]}} is
not |resetSequenceId|, abort these steps.
</li>
<li>[=Resolve=]
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
are still the same, set
with {{GamepadHapticsResult/"complete"}}.
</li>
<li>Set
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}
to `null`.
</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>
<li>[=Resolve=] |resetResultPromise| with
{{GamepadHapticsResult/"complete"}}
</li>
</ol>
</li>
<li>Return |resetResultPromise|.
<li>Return
[=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}}.
</li>
</ol>
</dd>
Expand Down
Loading