HTML5 deployment: progress comes into sight

hh hh at hyperhh.de
Wed May 31 23:35:37 CEST 2017


"Synchronous" means here that the callback is done in the order it appears in
the list of js instructions, i.e. "synchronous to the instruction order".

If you say in your js function

   instruction1;
   callback1;
   instruction2;
   callback2;

then you can't control what's done first. This is the price we have
to pay for speed (multi-threading).
It is even possible that callback2 arrives at LC _before_ one of
       instruction1; callback1; instruction2;
is finished.
That's what Jonathan tries to have (successfully in some scenarios)
by doing in the widget first
   instruction1; callback1;
then, after getting callback1:
   instruction2; callback2;

But even when going this way there is no guarantee that callback1/callback2)
arrives at the LC widget/card _after_ instruction1/instruction2 is done.
You have to work harder (in javascript) to reach at that point.

> > BR wrote: ... "What's very difficult, as you write in detail, are
> > "callbacks" for _synchronous_communication..."
> 
> Roland H. wrote:
> Callback functions?
> 
> In my mind, a "callback" is always asynchronous -? Let us say in Javascript
> - passing the function name and parameters of Javascript through LCS/LCB
> and then somehow the result is put into a variable while I am continuing
> processing other stuff. Maybe I am wrong? I am calling a server, waiting
> for the result, but I could wait forever and the result will possibly never
> come. So it would be blocking doing other things. A callback would free me
> from waiting for nothing. Is this a right definition for "callback"?
> 
> What defines "callback"? I could understand though that I am calling a
> function in the browser widget (using the "callback" name of the function)
> which will be executed through Javascript and will be returning a value for
> further processing. What means "synchronous" or "asynchronous" in this
> context?
> 
> Again, in my mind, a callback is when I send off a parcel to my friend with
> an instruction to tell me that it arrived and the confirmation of arrival.
> The confirmation is the callback. Then I know my friend received the
> parcel. Or in another analogy, I am calling someone by phone asking to call
> me back. The person may call immediately or may call never or in a couple
> of days. This is asynchronous.
> 
> How would a callback become synchronous? Is it then still a "callback"?



More information about the use-livecode mailing list