A callback is not synchronous, his point was that it would be nice to communicate synchronously between LC and JS, rather than use complex callback chains.
I agree with him, but I don't think there is a universal way to do that, just because some things in JavaScript, like rendering an image or using a webworker, are inherently asynchronous. Sent from my iPhone > On May 31, 2017, at 12:36 PM, Roland Huettmann via use-livecode > <use-livecode@lists.runrev.com> wrote: > > @BR wrote: ... "What's very difficult, as you write in detail, are > "callbacks" for _synchronous_communication..." > > 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"? > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode