Sign in Join

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

Mailing lists / pas2js / 2021-05

Async procedure.

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Michael Van Canneyt
to Henrique Gottardi Werlang
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.

Reply by email