I'd like to revive this thread from last month and argue for a different spec:

http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/99a70af45e06ed3d?pli=1

The question there was what a GWT Timer should do with a timeout of 0,
which is currently prohibited.  The thinking there was to mimick what
window.setTimeout does and use the minimum delay.  However, I agree
with this post by Eugene Lazutkin:

http://lazutkin.com/blog/2008/mar/23/javascript-edp-and-0ms-timeouts/

There is a lot of good use for having a mechanism for specifying a
callback that you want to run at the top of the event loop.  Eugene
argues that this is established practice for all kinds of very popular
GUI toolkits.  I would add that it's showing up in language designs
like Erlang and E.  This is a powerful tool for apps that are
architected around an event queue.

We can provide this facility, even though window.setTimeout doesn't do
what is necessary.  Here's a question, though: should the
functionality be provided in a new class, or would it be okay to make
Timer do it if the timeout is set to 0?  Updating Timer looks cleanest
to me..  However, it will occasionally trip up someone very
knowledgeable about browsers.  Such a person might out-clever
themselves by trying to use 0 to mean the minimum delay.

Opinions?

-Lex

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to