W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: GamepadObserver (ie. MutationObserver + Gamepad)

From: Rick Waldron <waldron.rick@gmail.com>
Date: Wed, 2 May 2012 18:12:49 -0400
Message-ID: <CAHfnhfpR_m8qgJW6E3YyMZ+yJnBjaPDPE_sp+yX0O9m+1B5mzg@mail.gmail.com>
To: olli@pettay.fi
Cc: Webapps WG <public-webapps@w3.org>
On Wed, May 2, 2012 at 5:54 PM, Olli Pettay <Olli.Pettay@helsinki.fi> wrote:

> 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<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.


I had originally argued for an event, though met with resistance. The
reasoning was that gamepad state changes are far too high resolution which
would result in high event dispatch volume.

Is there documented discussion surrounding the return to an event being
desirable?

Thanks for your time.


Rick



>
>
>
> -Olli
>
>
Received on Wednesday, 2 May 2012 22:14:10 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:52 GMT