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

Editorial: add a Model section #136

Open
wants to merge 5 commits into
base: gh-pages
Choose a base branch
from
Open
Changes from 4 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
62 changes: 62 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,68 @@ <h2>
sensing, depth sensing, video analysis, gesture recognition, and so on.
</p>
</section>

<section>
<h2>
Model
</h2>
<p>
A <dfn>gamepad</dfn> is a physical or virtual input device that provides
button and/or axis inputs. The <dfn>host</dfn> is the operating system
environment hosting the user agent. The host provides an algorithm for
<dfn data-lt="enumerating">enumerating connected gamepads</dfn>. A
gamepad is considered <dfn>connected</dfn> when the host is capable of
reading new inputs. A gamepad that is not connected is
<dfn>disconnected</dfn>.
</p>
<p>
The [=host=] provides an algorithm for synchronously
<dfn>reading input data</dfn> from the gamepad. If the host does not
provide such an algorithm, the user agent MAY implement an algorithm
that caches the most recent input data and synchronously returns the
cached value.
</p>
<p>
When a gamepad transitions from disconnected to connected, it
<dfn>becomes connected</dfn>. Likewise, when a gamepad transitions from
connected to disconnected, it <dfn>becomes disconnected</dfn>. The host
provides algorithms to register listeners for these transitions. If
these events are not available, the user agent MAY implement an
algorithm that synthesizes the events by periodically enumerating
connected gamepads.
</p>
<p>
The user agent MUST define a <dfn>gamepad user gesture</dfn>. A gamepad
user gesture is a class of gamepad input state transitions that signify
that the user is interacting with the gamepad. At a minimum, the gamepad
user gesture MUST include state changes where any button transitions
from unpressed to pressed. Other transitions can be included as user
gestures. A transition MUST NOT be included if the transition could
occur without user interaction.
</p>
<p>
The user agent MUST NOT expose information about connected gamepads
until a gamepad user gesture has been received from any connected
gamepad. The user gesture MUST be tracked independently for each gamepad
context. A <dfn>gamepad context</dfn> MUST be created when a page first
requests the current gamepad state or registers for gamepad connection
events. The gamepad context MUST be destroyed when the tab is closed or
navigates away from the current page. Reloading the current page MUST
NOT destroy the gamepad context.
</p>
<div class="issue">
<p>TODO: Integrate the gamepad context lifetime with the HTML spec.</p>
</div>
To register a user gesture, a gamepad context MUST be active. A gamepad
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Determining "active" is effectively and algorithm, so we should specify it as such.

context is <dfn>active</dfn> if the document associated with the context
is [=Document/visible=]. If the document is [=Document/hidden=], the
Comment on lines +192 to +193
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context is <dfn>active</dfn> if the document associated with the context
is [=Document/visible=]. If the document is [=Document/hidden=], the
context is <dfn>active</dfn> if the document associated with the context
has a [=Document/visibility state=] of "visible". If the document is has a [=Document/visibility state=] of "hidden", the

context is inactive. When a context is first created or when it
transitions from inactive to active, it <dfn>becomes active</dfn>.
Likewise, when it transitions from active to inactive, it <dfn>becomes
inactive</dfn>.
</p>
</section>

<section data-dfn-for="Gamepad" data-link-for="Gamepad">
<h2>
<dfn>Gamepad</dfn> interface
Expand Down