[Pas2js] External class with custom event

Mattias Gaertner nc-gaertnma at netcologne.de
Mon May 22 10:59:18 CEST 2023


On Mon, 22 May 2023 08:10:17 +0000 (UTC)
Luca Olivetti via Pas2js <pas2js at lists.freepascal.org> wrote:

>[...]
> gpt suggestion (that I didn't try because the "external name 'Event'"
> is already used for the definition of TJSEvent) is:
> 
> type
>    TEvent = class external name 'Event'
>    public
>      property target: TJSObject; external name 'target';
>      property currentTarget: TJSObject; external name 'currentTarget';
>      property type_: string; external name 'type';
>      property detail: TJSObject; external name 'detail';
>      // Add other properties and methods as needed
>    end;

Human intelligence:

type
  TChoisesDetail = class external name 'Something'
    ...
  end;

  TChoicesChoiceEvent = class external name 'ChoiceEvent' (TJSEvent)
  private
    FDetail: TChoisesDetail; external name 'detail';
  public
    property Detail: TChoisesDetail read FDetail; 
  end;

Mattias


More information about the Pas2js mailing list