- From: Olli Pettay <Olli.Pettay@helsinki.fi>
- Date: Thu, 03 May 2012 00:54:11 +0300
- To: Rick Waldron <waldron.rick@gmail.com>
- CC: Webapps WG <public-webapps@w3.org>
On 05/03/2012 12:48 AM, Rick Waldron wrote: > 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 no need for this kind of thing. Gamepad data is external, so dispatching events is better. The event can of course keep a list of changes since the previous event dispatch. -Olli
Received on Wednesday, 2 May 2012 21:54:43 UTC