Re: [gamepad] .gamepads vs. function access

We have stuff in the DOM that triggers layout like offsetWidth, so I don't mind implicit polling by accessing .gamepads. Key is to document and spread this knowledge. In a time where we have getters and setters in JS, things become confusing if not well documented.

Von: Vincent Scheib <scheib@google.com<mailto:scheib@google.com>>
Datum: Tue, 18 Oct 2011 23:42:57 -0700
An: Scott Graham <scottmg@google.com<mailto:scottmg@google.com>>
Cc: "public-webevents@w3.org<mailto:public-webevents@w3.org>" <public-webevents@w3.org<mailto:public-webevents@w3.org>>
Betreff: Re: [gamepad] .gamepads vs. function access

pollGamepads() to me implies that the data would be refreshed by me calling the function, which may be misleading if that's not the case.

.gamepads and .getGamepads() feel roughly equivalent in meaning to me, though the former easier to write and read.

I could see code with the intent, "go check the gamepads and see if anything new has happened". But I think a check for changed timestamps should suffice there. IMHO the name doesn't need a fix.

On Tue, Oct 18, 2011 at 10:58 AM, Scott Graham <scottmg@google.com<mailto:scottmg@google.com>> wrote:
Hi,

Currently, the gamepad spec says it's navigator.gamepads to get
polling-style access to the gamepad data.

In writing some sample code, I'm finding it feels a bit odd because
you don't know when the data is updated.

I'm inclined towards "navigator.pollGamepads()" or maybe
"navigator.getGamepads()" to make it more clear that you're getting a
copy that's (hopefully) up-to-date at that point.

Any positive or negative feelings on that?

scott

Received on Thursday, 20 October 2011 15:23:33 UTC