> The assignment to result.myData happens before the data service call is
> invoked, and this will work fine.  I believe that call does not happen
> until the next "frame".

Yes, exactly. Now the point is (or was really) that I wanted to
implement the same api interaction when model.doAction is not
asynchronous (doAction here stands for one of a few dozen methods that
are implemented on the model object). I naively tried to do that by
using dispatchEvent from within the synchronous doAction call, but
that did not really get me there because the eventlistener is invoked
at the time the dispatchEvent is invoked (beginners mistake I am sure)

Anyway, I have decided to turn everything around. After I (finally)
realized that using an event dispatching approach for model management
calls (sometimes through service invocations) is not really buying me
anything, I added the handlers and possible user data, both for the
synchronous and asynchronous methods, as arguments to the methods.
Although the method signatures get a bit heavy, I like that approach
better. It is consisten and it saves me from having to juggle with
eventlisteners and an application specific event structure. 

Of course... I would have preferred everything to be synchronous :)

Thanks for you reply,

Peter


Reply via email to