[Pas2js] serializing components

helioroots roots heliosroots at gmail.com
Sun Dec 19 14:56:27 CET 2021


function SaveComponent(AComponent: TComponent): string;
var
  VInput: TBytesStream;
  VOutput: TStringStream;
begin
  VInput := TBytesStream.Create(nil);
  VOutput := TStringStream.Create('');
  try
    VInput.WriteComponent(AComponent);
    VInput.Seek(0, soBeginning);
    ObjectBinaryToText(VInput, VOutput);
    Result := VOutput.DataString;
  finally
    VOutput.Free;
    VInput.Free;
  end;
end;


Function is working except for events... they are not serialized....
I believe the problem is in


Class function TObject.MethodName(aCode : Pointer) : String;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211219/a984ea13/attachment.htm>


More information about the Pas2js mailing list