- From: <bugzilla@jessica.w3.org>
- Date: Thu, 18 Dec 2014 14:46:52 +0000
- To: public-webapps-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26181 --- Comment #30 from Ted Mielczarek [:ted] <ted@mielczarek.org> --- For #2, WebIDL has recently grown a maplike declaration that we could use: http://heycam.github.io/webidl/#dfn-maplike-declaration Presumably the resulting spec would look something like: partial interface Navigator { GamepadList getGamepads(); }; interface GamepadList { readonly maplike<unsigned long, Gamepad>; }; This doesn't seem overly terrible, but it does add a fair bit of implementation complexity just to avoid exposing a value for disconnected controllers. In reality, most of the usage examples I've seen (and written) have looked like: var gamepads = navigator.getGamepads(); for (var i = 0; i < gamepads.length; i++) { if (gamepads[i]) { ... } } which works either way. If we implemented #2 then you could eventually write: for (var gamepad of navigator.getGamepads()) { ... } which is certainly appealing. -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Thursday, 18 December 2014 14:46:57 UTC