DeferredCommand really is, and always has been, meant to be exactly the same
thing as "invokeLater()". I do agree with Kelly that the implementation
became heavyweight by being intertwined with IncrementalCommand, and that we
should undo it. (It seemed like a good idea at the time...)
@Lex: Do you know of a way to accomplish what you're proposing? I wasn't
aware of anything other way to get delayed execution other than using a
0-delay timer. I agree with all the points that have been made
philosophically, but I just don't know how we could change DeferredCommand
to be implemented any other way.

On Tue, Jan 13, 2009 at 10:41 AM, Lex Spoon <[email protected]> wrote:

> On Mon, Jan 12, 2009 at 2:13 PM, Kelly Norton <[email protected]> wrote:
> > We actually have it, it's called DeferredCommand. Unfortunately, we let
> its
> > implementation get too gangled up with another feature called
> > IncrementalCommand and use of DeferredCommand now generates way too much
> > code. Many developers still use DeferredCommand when wanting to
> invokeLater.
>
> I was thinking of DeferredCommand, and using it as a way to get
> invokeLater.  However, I am pretty sure we don't currently have what I
> am asking for.  Using a DeferredCommand boils down to a Timer, which
> uses setTimeout.  Thus, a minimum-duration DeferredCommand should
> happen one time tick later and after a repaint of the browser window.
>
> I'm getting the impression that a 0-length timer is strongly ingrained
> for AJAX programmers to mean wait for a minimum time tick.  If so,
> then invokeLater should be a separate mechanism unrelated to Timers.
> Any opinions on where in the GWT library to add an invokeLater method?
>
> Perhaps invokeLater could be a static method in DeferredCommand, and
> runInvokeLaterCommands would be a default-access static method in the
> same?  Every place in GWT that installs a global event handler should
> also call runInvokeLaterCommands.  In addition, there could be a
> periodic timer that calls runInvokeLaterCommands, to catch any cases
> that were missed.
>
> To make it easy to not miss these cases, we could add
> GWT.runGwtCode(Command), which is intended to be used by all entry
> points from the browser into GWT code.  GWT.runGwtCode would take care
> of both the global exception handler and calling
> runInvokeLaterCommands.
>
>
> -Lex
>

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

Reply via email to