[Pas2js] Async, AWait
silvioprog
silvioprog at gmail.com
Thu May 28 14:25:03 CEST 2020
On Thu, May 28, 2020 at 5:12 AM Michael Van Canneyt <michael at freepascal.org>
wrote:
> On Thu, 28 May 2020, Mattias Gaertner via Pas2js wrote:
> > Hi all,
> >
> > pas2js trunk now supports async procedures and await functions.
> > This can greatly simplify writing asynchronous code, like starting a
> > download, handle the result, depending on the result download the next
> > piece and so forth.
> > Formerly you needed some (anonymous) functions for that. Now you can
> > write asynchronous code, that looks like normal, synchronous
> > code.
> >
> > https://wiki.freepascal.org/pas2js_AsyncAWait
>
>
> I have added the demos from the wiki page to the demo dir in the sources,
> fixed a small error in one of the demos.
>
> Enjoy !
>
> Michael.
I have a question.
Is it possible to use parameters-less at the await part? For example:
function foo: TJSBlob; *async*;
var
r: TJSResponse;
begin
r := *await* window.fetch(url);
...
Result := *await* r.blob();
end;
Thank you!
--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20200528/f8e0c2d9/attachment.htm>
More information about the Pas2js
mailing list