[Pas2js] JS Sync/Async Limitations
Sergei Vertiev
vertiev at gmail.com
Thu Feb 21 16:30:46 CET 2019
Hello, Michael.
>>> Webworkers more or less replace this, but they work
>>> simply asynchronously.
"webworker" can be started from some function,
and the only way to communicate with particular "worker" is
sending/getting messages.
But receiving messages is async and so we only able
to receive something from worker after exit function.
This is limitation of JS VM.
The only known by me sync/async solution is "waitfor"
feature implemented in Dart language, which intended
to wait for async function. But as i read this feature
marked as "experimental"...
https://api.dartlang.org/dev/2.0.0-dev.30.0/dart-cli/waitFor.html
Best Regards.
Sergei Vertie
On Thu, Feb 21, 2019 at 6:07 PM Michael Van Canneyt
<michael at freepascal.org> wrote:
>
>
>
> On Thu, 21 Feb 2019, Michael Schnell wrote:
>
> >> http://wiki.freepascal.org/Porting_from_FPC/Delphi_to_pas2js
> >>
> >
> > "There is no multithreading"
> >
> > Will multithreading never be implemented ?
>
> No. Webworkers more or less replace this, but they work
> simply asynchronously.
>
> >
> > It seems like providing a GUI in the browser and at the same time communicating with a server could ask for this.
> > Or does the "Many calls are asynchronous and return immediately" feature prevent the need for threads.
>
> It does.
>
> >
> > But how do a program that can be run as well in the Browser as natively.
>
> Every call that is asynchronous in the browser can be more or less emulated
> using a thread in a native app, to have the same "async" logic.
>
> Michael.
> _______________________________________________
> Pas2js maillist - Pas2js at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
More information about the Pas2js
mailing list