[Pas2js] Class constant with "external" class

Michael Van Canneyt michael at freepascal.org
Sat Jan 27 10:46:23 CET 2018



On Fri, 26 Jan 2018, warleyalex via Pas2js wrote:

> the codegen does not emit corresponding const.
>
> type
>  TBase = class external name 'TBase'
>  public
>    (* class var cPublic : String = '{"name":"warleyx"}'; *)  // not supported
>    class const cTemp = '{"page:about2"}';

What is that definition supposed to mean ?

An external class is exactly that: 
The import definition of an existing javascript class.

So:

- either cTemp exists in this external class and has a value,
   this means you don't need to specify it,

- or cTemp is an addition, which you should not do in this class definition,
   but in a descendent class.

If cTemp exists and is read-write, you need to create a class var.

Provided it works, of course. It's not clear to me what a class var would
be in Javascript.

Michael.


More information about the Pas2js mailing list