Sorry, "Wait" may have a misnomer here. I don't mean to have browser
block waiting for the asynchronous calls to finish.
What I mean is, before launching another asynchronous call, flush out
the AsyncCallbacks in the stack.
In a complicated UI screen, when saving the record, each field may go
through different validation asynchronous calls. Saving the record
without waiting for the previous asynchronous calls to finish will
result in unpredictible behavior. For example, validation may change
some record value. If save is invoked before validations are finished,
old values may be saved.
I thought DeferredCommand.addCommand() would serve the purpose. From
the javadoc
Enqueues a Command to be fired after all current events have been
handled. Note that the Command should not perform any blocking
operations.
I am wondering if the "events" include asynchronous calls, or are they
just referring to DOM events.
On Apr 27, 6:41 pm, Vitali Lovich <
vlov...@gmail.com> wrote:
> No. "Waiting" in the browser means it freezes it (remember - single
> threaded). Why not just disable the input fields that can lead to an RPC
> call (& some kind of processing indicator so the user understands what's
> going on) & reenable them when the call completes.
>
> Just apply a proper MVC pattern & you'r code should be clean (i.e. your
> controller will disable the view when the model is busy updating the backend
> & reenable it when the model indicates it is finished).
>