[Pas2js] Pas2js 1.4.30

warleyalex warleyalex at yahoo.com.br
Wed Jul 8 22:50:47 CEST 2020


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;





--
Sent from: http://pas2js.38893.n8.nabble.com/


More information about the Pas2js mailing list