[Pas2js] JS Sync/Async Limitations

Sergei Vertiev vertiev at gmail.com
Thu Feb 21 15:57:51 CET 2019


Hello, Mattias, thanks to you...

>> I started a page for Delphians porting code to
>> pas2js. Feel free to improve it:

I read  "Asynchronous vs Waiting" article.
This is short, but significant and true.

But seems, there are no ways to overcame this "Async/vs Waiting" obstacle.
I've tried seemed everything, before realize that ALL Async stuff starts to
processing only AFTER we leave our (syncronious) function.

This means that we simply unable to implement some functionality in JS,
which goes from Pas code.

Still sync operations and UI callbacks as Events works fine
and this is quite enough for certain types of tasks.

Best Regards.
Sergei Vertie

On Thu, Feb 21, 2019 at 4:32 PM Mattias Gaertner via Pas2js
<pas2js at lists.freepascal.org> wrote:
>
> On Thu, 21 Feb 2019 12:24:49 +0300
> Sergei Vertiev <vertiev at gmail.com> wrote:
>
> >[...]
> > Spending some time and doing some afforts, i managed to compile alot
> > of files to JS. That was really inspiring moment.
> > (BTW, JS code is really perfect and easy to understand and debug).
>
> Thanks!
> It was Michael's idea to keep the Pascal structure intact, to make
> debugging of even big webapps easy.
>
>
> >[...]
> > And there are no ways to avoid async operations.
> > Http Get/Post works asynchroniusly, alot of JS APIs have
> > only Async methods (e.g. IndexedDB)...
> >
> > This is most significant difference between Delphi and JS
> > behavior and unfortunatelly my "experimental" project which
> > starts so happyly - stuck at this point.
> >
> > Sure, cool JS programmers know about this specific very well.
> > But, i was unaware of this, and i think that many Pascal/Delphi
> > programmers don't know about this JS specific neither.
> >
> > So, simply decide to share this knowladge with you.
>
> Thanks for sharing. I hope you find a solution.
>
> I started a page for Delphians porting code to
> pas2js. Feel free to improve it:
> http://wiki.freepascal.org/Porting_from_FPC/Delphi_to_pas2js
>
> Mattias
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js


More information about the Pas2js mailing list