[Pas2js] Change in event handler

Michael Van Canneyt michael at freepascal.org
Tue Aug 20 09:37:08 CEST 2019


Hello,

Based on a recent remark on the list, and after careful checking of the
documentation, the  TEventListenerEvent class has been made an alias of
TJSEvent:

TEventListenerEvent = TJSEvent;

That means that the 2 event handler types

   TJSEventHandler = reference to function(Event: TEventListenerEvent): boolean;
   TJSRawEventHandler = reference to Procedure(Event: TJSEvent);

are now in fact equivalent, except for the return value of the latter.

At the same time, the TJSEvent class definition has been corrected:

The currentTarget and Target properties of TJSEvent are now of type TJSEventTarget, as
they are in the official specs:

     property currentTarget : TJSEventTarget Read FCurrentTarget;
     property target : TJSEventTarget Read FTarget;

For convenience, I have added 2 additional properties:

     property currentTargetElement : TJSElement;
     property targetElement : TJSElement;

2 examples were corrected to handle this change, you may need to check your
code.

The change has been documented in the wiki:

https://wiki.freepascal.org/Pas2JS_Version_Changes#Trunk

Michael.



More information about the Pas2js mailing list