Lex said "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"
I'd be careful with this. It sounds like you want a GWT-maintained event pump queue, and have the queue pumped by any triggered event handler or timer. I think there's a danger in doing this manually. If all queue items are done within the context of a single handler-trigger, you could slow responsiveness of the user's browser/UI and the developer would be like "what? my handler does almost nothing, why am I getting slow script warnings and sluggish UI" In reality, the queue would have to be pumped similar to incremental command, staging it over several timer triggers until it was empty. -Ray On Tue, Jan 13, 2009 at 3:26 PM, Bruce Johnson <[email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---
