W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2013

Re: [whatwg] Polling APIs in JavaScript vs Callbacks

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sat, 9 Feb 2013 09:43:11 -0700
Message-ID: <CAAWBYDCZuFYVKxz_5kdz7oszmPSwYD_GU9qN_DuF6qo0sY1LVg@mail.gmail.com>
To: Glenn Maynard <glenn@zewt.org>
Cc: Gregg Tavares <gman@google.com>, WHATWG <whatwg@lists.whatwg.org>
On Thu, Feb 7, 2013 at 6:32 PM, Glenn Maynard <glenn@zewt.org> wrote:
> This is just to say: callbacks are the pattern on on the platform, not
> polling, and WebGL should follow that pattern, not go its own way and make
> up its own conventions.  If people don't understand why the platform's
> conventions are what they are, and think they should be something else,
> please encourage them to come here and discuss it--not to try to make WebGL
> its own isolated island.  That's damaging to WebGL and the platform as a
> whole.

Completely correct, and I agree.

That said, there *are* still some isolated use-cases for polling.  ^_^
 When an event-based approach would potentially deliver far too many
events, with separation between them perhaps less than 1ms, exposing a
polling-based API instead can be useful.  I haven't followed the
Gamepad API lately, but I know this was at least considered for some
of the types of feedback, such as the exact position of joysticks or
pressure on buttons, both of which can change very rapidly in
realistic scenarios.

Outside of these kinds of constraints, though, polling is a no-no, for
the reasons that Glenn gives.

~TJ
Received on Saturday, 9 February 2013 16:43:58 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:19 UTC