[whatwg] Polling APIs in JavaScript vs Callbacks

Elliott Sprehn esprehn at gmail.com
Mon Feb 11 20:52:43 PST 2013

On Sat, Feb 9, 2013 at 8:43 AM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:

> On Thu, Feb 7, 2013 at 6:32 PM, Glenn Maynard <glenn at 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

There's no reason to poll on the web.

- E

More information about the whatwg mailing list