Sign in Join

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

Mailing lists / pas2js / 2020-06

Descending a Pascal class from a JS Function

2 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner
to Mattias Gaertner
[...] pas2js trunk now supports descending a Pascal class from such a JS Function.

Note that pas2js checks for an ancestor class with external name 'Function'. You don't need to use TJSFunction from unit JS. If you don't like to drag in all the TJSFunction/TJSObject members, you can use:

type
  TJSMinimalFunction = class external name 'Function'
  end;
  TFrameworkFuncClass = class external name
  'FWFunc'(TJSMinimalFunction)
    constructor New;
  end;
  TMyDescendant = class(TFrameworkFuncClass)
  end;

Analog: If you want to descend from a JS Object, which is not a Function you can do:

type
  TFrameworkObject = class external name 'FWObject'
  end;
  TMyDescendant = class(TFrameworkObject)
  end;

Mattias

Reply by email