- From: Rick Waldron <waldron.rick@gmail.com>
- Date: Wed, 2 May 2012 17:48:50 -0400
- To: Webapps WG <public-webapps@w3.org>
- Message-ID: <CAHfnhfpsa2epU5smyEcaOZhtdO5okDXi8kW+hqDHDg5PFwCtTA@mail.gmail.com>
Instead of traditional DOM events being used for Other Events[1], and
considering the high frequency of Gamepad state changes, it might make
sense to provide an API similar to MutationObserver, where a MutationRecord
is created that has snapshots of current and previous states of axes or
buttons...
This is entirely hypothetical:
(new GamepadObserver(function(mutations) {
console.log( mutations );
/*
{
previousState: {
readonly attribute string id;
readonly attribute long index;
readonly attribute DOMTimeStamp timestamp;
// Either or both of the following, bases on the options list
readonly attribute float[] axes;
readonly attribute float[] buttons;
}
currentState: {
readonly attribute string id;
readonly attribute long index;
readonly attribute DOMTimeStamp timestamp;
// Either or both of the following, bases on the options list
readonly attribute float[] axes;
readonly attribute float[] buttons;
}
}
*/
})).observe(navigator.gamepads[0], { axesList: true });
// axesList, buttonsList
[1] http://dvcs.w3.org/hg/gamepad/raw-file/tip/gamepad.html#other-events
Rick
Received on Wednesday, 2 May 2012 21:49:40 UTC