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

Re: [whatwg] Polling APIs in JavaScript vs Callbacks

From: Elliott Sprehn <esprehn@gmail.com>
Date: Mon, 11 Feb 2013 20:52:43 -0800
Message-ID: <CAPJYB1hxRKU6UAcQMDALTb=jQR-0c+Eg-hPsUn3fiHp=eaenOw@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Gregg Tavares <gman@google.com>, WHATWG <whatwg@lists.whatwg.org>, Glenn Maynard <glenn@zewt.org>
On Sat, Feb 9, 2013 at 8:43 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> 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 disagree, there's no reasonable reason for polling. If the events would
fire too frequently then the API should be designed to batch up the
notifications and fire at specific checkpoints like rAf or end of micro
task.

There's no reason to poll on the web.

- E
Received on Tuesday, 12 February 2013 04:53:48 UTC

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