Sign in Join

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

Mailing lists / pas2js / 2020-07

Pas2js 1.4.30

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

warleyalex
to Mattias Gaertner

I updated pas2js today, "Pas2JS Compiler version 1.5.1 [2020/07/08] for Win64 x86_64".

a) the lazarus code completion does not work for me; In my project, which it uses the keyword "async".
The workaround is:
a) I have to include the definition InLazIDE in the current project; b) I have to edit the web.pas unit I and include at the top:

  {$define SkipAsync}

c) the code completion does not understand the syntax "varargs of JSValue", I had to change to:
varargs; // of JSValue;

Reply by email

warleyalex
to warleyalex

Another suggestion is to remove the following definition

--> procedure addEventListener(aname : string; aListener : JSValue);
from the TJSEventTarget class. This definition is inefficient for me;
procedure TApplication.onBtn1Click(event: TJSEvent);
begin
end;
var
  outputElm: TJSElement;
begin
outputElement := document.querySelector('#btn1');
// it works as expected with pointer approach
outputElement.addEventListener('click', @onBtn1Click);
// but does not work with anomymous function approach:
outputElement.addEventListener('click', procedure(event: TJSEvent)
begin
  console.log(event.targetElement.id);
end);
==> to work to both approaches, I have to remove the definition
//--> procedure addEventListener(aname : string; aListener : JSValue);
end;

Reply by email

Mattias Gaertner
to warleyalex: I updated pas2js today, "Pas2JS Compiler version 1.5.1 [2020/07/08] for Win64 x86_64". a)…
Show quoted text 5 lines
I updated pas2js today, "Pas2JS Compiler version 1.5.1 [2020/07/08] for Win64 x86_64". a) the lazarus code completion does not work for me; In my project, which it uses the keyword "async".

Please check that you are using the right IDE, because Lazarus trunk and fixes supports the async/await since I announced the pas2js feature.

Show quoted text 7 lines
The workaround is: a) I have to include the definition InLazIDE in the current project; b) I have to edit the web.pas unit I and include at the top: {$define SkipAsync} c) the code completion does not understand the syntax "varargs of JSValue", I had to change to: varargs; // of JSValue;

Same here.

Mattias

Reply by email