Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2021-06

RES: Pas2js Digest, Vol 39, Issue 2

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Henrique Gottardi Werlang

Thanks for the replys!

I suggested this because I'm implementing an API in Delphi. And in Delphi there is nothing equivalent to JSValue. Of course, you could declare any type with that name, to return, but it's not the idea, because the client and server share the same unit that has the contract interface.

And in this interface there is a procedure that does something, which can take time to finish.

So on the client side I need this to return a promise, so the browser doesn't get stuck.

I made a change to the local fonts I have from the compiler, that when the procedure is asynchronous, I make the procedure return a promise.

Of course this in a way violates pascal's concepts, but it got a lot better the implementations made, with this happening.

I'm not going to record any assignments regarding that, unless you think that's interesting.

De: <mailto:>
Enviado:terça-feira, 1 de junho de 2021 08:34
Para: <mailto:>
Assunto: Pas2js Digest, Vol 39, Issue 2

Send Pas2js mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freepascal.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fpas2js&amp;data=04%7C01%7C%7Cb70fc2dc548144f7f77408d924f12a9e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637581440485925406%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=k2KdbYS2pZ8iFxyrdneatAfY%2BUOqqlSYwTDXYv7VYE4%3D&amp;reserved=0 or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific than "Re: Contents of Pas2js digest..."

Today's Topics:

1. RES: Pas2js Digest, Vol 39, Issue 1 (Henrique Gottardi Werlang)
2. Re: RES: Pas2js Digest, Vol 39, Issue 1 (Michael Van Canneyt)
3. Re: RES: Pas2js Digest, Vol 39, Issue 1 (Wagner Landgraf)
4. Re: RES: Pas2js Digest, Vol 39, Issue 1 (Mattias Gaertner)

----------------------------------------------------------------------

Message: 1
Date: Tue, 1 Jun 2021 10:33:08 +0000
From: Henrique Gottardi Werlang
To: ""
Subject: [Pas2js] RES: Pas2js Digest, Vol 39, Issue 1 Message-ID:

Content-Type: text/plain; charset="windows-1252"

Unit MyTest;
procedure Run; async;
begin
  // do something...
end;
begin
   run()._then(function (a : jsvalue) : jsvalue
     begin
     end);
end.

In the line "run()._then(function (a : jsvalue) : jsvalue” give me the error “Error: illegal qualifier "." after " run():Procedure/Function"”

De: <mailto:>
Enviado:terça-feira, 1 de junho de 2021 07:00
Para: <mailto:>
Assunto: Pas2js Digest, Vol 39, Issue 1

Send Pas2js mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freepascal.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fpas2js&amp;data=04%7C01%7C%7Cb70fc2dc548144f7f77408d924f12a9e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637581440485925406%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=k2KdbYS2pZ8iFxyrdneatAfY%2BUOqqlSYwTDXYv7VYE4%3D&amp;reserved=0 or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific than "Re: Contents of Pas2js digest..."

Today's Topics:

1. Async procedure. (Henrique Gottardi Werlang)
2. Re: Async procedure. (Michael Van Canneyt)

----------------------------------------------------------------------

Message: 1
Date: Mon, 31 May 2021 18:18:34 +0000
From: Henrique Gottardi Werlang
To: ""
Subject: [Pas2js] Async procedure.
Message-ID:

Content-Type: text/plain; charset="windows-1252"

I'm making a remote request client and I had a problem.

I declared an asynchronous procedure, but it doesn't generate a promise.

This I can't register the "then” event.

Is it possible to modify this procedure behavior?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.freepascal.org%2Fpipermail%2Fpas2js%2Fattachments%2F20210531%2F05d3a71c%2Fattachment-0001.htm&amp;data=04%7C01%7C%7Cb70fc2dc548144f7f77408d924f12a9e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637581440485925406%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=IHXivkgU%2BCOp2lp5hFbwuS5sFO8DuJidF47L%2BFMZl54%3D&amp;reserved=0>

------------------------------

Message: 2
Date: Mon, 31 May 2021 21:06:32 +0200 (CEST)
From: Michael Van Canneyt
To: pas2js discussions
Subject: Re: [Pas2js] Async procedure.
Message-ID: <alpine.DEB.2.22.394.2105312102530.1614564 at home> Content-Type: text/plain; charset="windows-1252"; Format="flowed"

Henrique Gottardi Werlang wrote 5 lines
I'm making a remote request client and I had a problem. I declared an asynchronous procedure, but it doesn't generate a promise. This I can't register the "then” event.

Works fine here:

uses JS;
function Run: word; async;
begin
   Result:=3;
end;
begin
   run()._then(function (a : jsvalue) : jsvalue
     begin
     end);
end.

or

uses JS;
function Run: word; async;
begin
   Result:=3;
end;
var
   p: TJSPromise;
begin
   p:=Run(); // calling directly without await() returns a TJSPromise!
   p._then(function (a : jsvalue) : jsvalue
     begin
     end);
end.

So what does not work for you ?

Michael.

------------------------------

Subject: Digest Footer

Reply by email