[Pas2js] How to pass an unknown record to a function as argument?

Michael Van Canneyt michael at freepascal.org
Mon Jun 15 15:11:19 CEST 2020

On Mon, 15 Jun 2020, warleyalex via Pas2js wrote:

> I use the record structure to map to a table and store/retrieve the data.


> and so on... // without overloading the external class definition
> localDB.each('SELECT * FROM album', procedure(columnName: TAlbumRecord)
> begin
>  console.log(columnName.Nome);
>  console.log(columnName.CPF); 
> end,
> procedure() 
> begin 
> end);

When generics are released, a generic function could be used for this.

In the current version you can also write a helper class with an overloaded
version of the call.


More information about the Pas2js mailing list