Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

Pas2JS Version Changes

Releases

Next Version

3.0.1

27th Feb 2024

Changes:

3.0.1 Incompatibilities

Unitpaths of default packages in pas2js.cfg

Version 2.2.0

22th Feb 2022

All changes of version 2.2.0

text
 xhr.addEventListener('load', @OnLoad);
 xhr.removeEventListener('load', @OnLoad);

2.2.0 Incompatibilities

pas2js.cfg

Version 2.0.6

15th Apr 2021

Version 2.0.4

26th Mar 2021

Version 2.0.2

9th Mar 2021

Version 2.0.0

11th Jan 2021

All changes of version 2.0.0

Version 2.0.0RC8

31th Dec 2020

Version 2.0.0RC7

13th Dec 2020

Version 2.0.0RC6

8th Dec 2020

Version 2.0.0RC5

4th Dec 2020

Version 2.0.0RC4

30th Nov 2020

Version 2.0.0RC3

13th Nov 2020

Version 2.0.0RC2

11th Nov 2020

Version 2.0.0RC1

5th Nov 2020

All changes of version 2.0.0

Insert these directives in front of your dispatch methods to let the compiler check all methods with message modifiers if they pass a record with the right field.

pascal
  TMyComponent = class
    {$DispatchField Msg}
    procedure Dispatch(var aMessage); virtual;
    {$DispatchStrField MsgStr}
    procedure DispatchStr(var aMessage); virtual;
  end;
  TMouseDownMsg = record
    Id: integer; // Id instead of Msg, works in FPC, but not in pas2js
    x,y: integer;
  end;
  TMouseUpMsg = record
    MsgStr: string;
    X,Y: integer;
  end;
  TWinControl = class
    procedure MouseDownMsg(var Msg: TMouseDownMsg); message 3; // warning: Dispatch requires record field Msg
    procedure MouseUpMsg(var Msg: TMouseUpMsg); message 'up'; // ok, record with string field name MsgStr
  end;
pascal
  procedure SumWords(); varargs of Word;
  ...
  SumWords(1,2,3); // this works
  SumWords(1,98765); // this gives a range check error

2.0.0 Incompatibilities

Signature for event handlers TEventListenerEvent and TJSEvent

The signature for event handlers has been corrected. The class TEventListenerEvent is now an alias for TJSEvent

That means that the 2 event handler types

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

are now equivalent.

TJSEvent type definition

The TJSEvent type definition has been corrected

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

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

For convenience, a targetElement and CurrentTargetElement property have been added which are of type TJSElement:

text
   property currentTargetElement : TJSElement;
   property targetElement : TJSElement;

modeswitch ignoreattributes was removed

The workaround {$modeswitch ignoreattributes} was removed. Attributes are now implemented.

Version 1.4.34

28th Oct 2020

Version 1.4.32

15th Oct 2020

Version 1.4.30

8th July 2020

Version 1.4.28

3rd Jul 2020

Version 1.4.26

6th Jun 2020

Version 1.4.24

11th May 2020

Version 1.4.22

10th May 2020

Version 1.4.20

11th April 2020

Version 1.4.18

15th Dec 2019

Version 1.4.16

15th Oct 2019

Version 1.4.14

30th Aug 2019

Version 1.4.12

28th Aug 2019

Version 1.4.10

10th Jul 2019

Version 1.4.8

24th June 2019

Version 1.4.6

20th Apr 2019

Version 1.4.4

19th Apr 2019

Version 1.4.2

11th Apr 2019

Version 1.4.0

24th Mar 2019

Version 1.4.0RC7

16th Mar 2019

Version 1.4.0RC6

8th Mar 2019

Version 1.4.0RC5

6th Mar 2019

Version 1.4.0RC4

3rd Mar 2019

Version 1.4.0RC3

27th Feb 2019

Version 1.4.0RC2

18th Feb 2019

Version 1.4.0RC1

16th Feb 2019

All changes of version 1.4.0

pascal
type 
  TClassOfBird = class of TBird;
const k = 1;
type 
  TBird = class end;

Version 1.2.0

Version 1.2.0RC1

pascal
type
  TRefProc = reference to procedure;
  TProc = procedure;
procedure DoIt(arg: TRefProc);
var 
  ref: TRefProc;
  proc: TProc;
begin
  ref:=procedure begin end; // assign to "reference of procedure" type
  ref:=procedure  // note the omitted semicolon
    var i: integer; // var, types, const, local procedures
    begin
    end; 
  DoIt(procedure begin end); // pass as argument
  refproc:=procedure assembler asm// embed JavaScript // embed JavaScript
      console.log("foo");
    END; 
  // Note that typecasting to non "reference to" does not make a difference 
  // because in JS all functions are closures:
  proc:=TProc(procedure begin end);   
end;

Version 1.0.4

Version 1.0.3

pascal
function GetItems(const i: integer): byte;
property Items[i: integer]: byte read GetItems;

Version 1.0.2

Version 1.0.1

Version 1.0.0

Version 1.0.0rc1

Version 0.9.32

Version 0.9.31

Version 0.9.30

Version 0.9.29

Version 0.9.28

Version 0.9.27

Version 0.9.26

Version 0.9.25

Version 0.9.24

Version 0.9.23

Version 0.9.22

Version 0.9.21

Version 0.9.20

Version 0.9.19

Version 0.9.18

Version 0.9.17

Version 0.9.16

Version 0.9.15

Version 0.9.14

Version 0.9.13

Version 0.9.12

Version 0.9.11

Version 0.9.10

Version 0.9.9

Version 0.9.8

Version 0.9.7

Version 0.9.6

Version 0.9.5

Version 0.9.4

Version 0.9.3

Version 0.9.2

Version 0.9.1

Version 0.9.0

Version 0.8.45

Version 0.8.44

Version 0.8.43

Version 0.8.42

Version 0.8.41

Version 0.8.40

Version 0.8.39

Version 0.8.38

Version 0.8.37

Version 0.8.36

Version 0.8.35

Version 0.8.34

Version 0.8.33

Version 0.8.32

Version 0.8.31

Version 0.8.30

Version 0.8.29

Version 0.8.28

Version 0.8.27

Version 0.8.26

Version 0.8.25

Version 0.8.24

Version 0.8.23

Version 0.8.22

Version 0.8.21

Version 0.8.20

Version 0.8.19

Version 0.8.18

pascal
  TFloatRec = Record
     ...
     Digits: Array Of Char;
  End;

Version 0.8.17

Version 0.8.16

Version 0.8.15

Version 0.8.14

In Delphi/FPC obj.Free works even if obj is nil. In JavaScript this would crash. And to free memory JS requires to clear all references, which is not required in Delphi/FPC. Therefore the compiler adds code to check for null, call the destructor and sets the variable to null.

It does not support freeing properties and function results. For example: List[i].Free; will give a compiler error. The property setter might create side effects, which would be incompatible to Delphi/FPC.

Version 0.8.13

Version 0.8.12

Version 0.8.11

Version 0.8.10

Version 0.8.9

Current aliases:

pascal
JSInteger = NativeInt;
pascal
Integer = LongInt;
Cardinal = LongWord;
SizeInt = NativeInt;
SizeUInt = NativeUInt;
PtrInt = NativeInt;
PtrUInt = NativeUInt;
ValSInt = NativeInt;
ValUInt = NativeUInt;
ValReal = Double;
Real = Double;
Extended = Double;
pascal
Int64 = NativeInt unimplemented;
QWord = NativeUInt unimplemented;
Single = Double unimplemented;
Comp = Int64 unimplemented;
pascal
UnicodeString = String;
WideString = String;
WideChar = char;

Version 0.8.8

Version 0.8.7

Version 0.8.6

Version 0.8.5

Version 0.8.4

Version 0.8.3

Trunk

Navigation


From the Free Pascal wiki, page "Pas2JS Version Changes", as it stood on 2024-02-28 after a change by Mattias2, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 3, last changed by WikiArchive .