From bcfe048a8f184d124c73a5dbe16e04d77f5c8643 Mon Sep 17 00:00:00 2001
From: Matt Reynolds
sensing, depth sensing, video analysis, gesture recognition, and so on.
+ A gamepad is a physical or virtual input device that provides + button and/or axis inputs. The host is the operating system + environment hosting the user agent. The host provides an algorithm for + enumerating connected gamepads. A + gamepad is considered connected when the host is capable of + reading new inputs. A gamepad that is not connected is + disconnected. +
++ The [=host=] provides an algorithm for synchronously + reading input data 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. +
++ When a gamepad transitions from disconnected to connected, it + becomes connected. Likewise, when a gamepad transitions from + connected to disconnected, it becomes disconnected. 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. +
++ The user agent MUST define a gamepad user gesture. 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. +
++ 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 gamepad context 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. TODO: Integrate the gamepad context + lifetime with the HTML spec. +
++ To register a user gesture, a gamepad context MUST be active. A gamepad + context is active if the document associated with the context + is [=Document/visible=]. If the document is [=Document/hidden=], the + context is inactive. When a context is first created or when it + transitions from inactive to active, it becomes active. + Likewise, when it transitions from active to inactive, it becomes + inactive. +
++
TODO: Integrate the gamepad context lifetime with the HTML spec.
+