<div dir="ltr"><div dir="ltr">On Thu, May 28, 2020 at 5:12 AM Michael Van Canneyt <<a href="mailto:michael@freepascal.org">michael@freepascal.org</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
On Thu, 28 May 2020, Mattias Gaertner via Pas2js wrote:<br>
> Hi all,<br>
><br>
> pas2js trunk now supports async procedures and await functions.<br>
> This can greatly simplify writing asynchronous code, like starting a<br>
> download, handle the result, depending on the result download the next<br>
> piece and so forth.<br>
> Formerly you needed some (anonymous) functions for that. Now you can<br>
> write asynchronous code, that looks like normal, synchronous<br>
> code.<br>
><br>
> <a href="https://wiki.freepascal.org/pas2js_AsyncAWait" rel="noreferrer" target="_blank">https://wiki.freepascal.org/pas2js_AsyncAWait</a><br>
<br>
<br>
I have added the demos from the wiki page to the demo dir in the sources,<br>
fixed a small error in one of the demos.<br>
<br>
Enjoy !<br>
<br>
Michael.</blockquote><div><br></div><div>I have a question.</div><div><br></div><div>Is it possible to use parameters-less at the await part? For example:</div><div><br></div><div><font face="monospace" size="1">function foo: TJSBlob; <b>async</b>;</font></div><div><font face="monospace" size="1">var</font></div><div><font face="monospace" size="1"> r: TJSResponse;<br>begin<br> r := <b>await</b> window.fetch(url);</font></div><div><font face="monospace" size="1"> ...<br> Result := <b>await</b> r.blob();<br>end;</font><br></div><div><br></div><div>Thank you!</div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div></div>