[Pas2js] Class constant with "external" class
Mattias Gaertner
nc-gaertnma at netcologne.de
Sat Jan 27 12:05:46 CET 2018
On Sat, 27 Jan 2018 11:23:14 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:
>[...]
> Yes, but how would I define this in javascript ?
> Not add it to a prototype ?
My remark was about JS objects created by Object.create(aclass).
When an object is created via the 'new' operator, it uses the
'prototype' as ancestor, which corresponds to
Object.create(aclass.prototype). In that case a class-var should
either access the aclass.prototype.classvar or forbid it.
The question is how pas2js should recognize that.
a) When a class descends from JS 'Function'
b) When the class has a constructor 'New'.
c) both
What do you think?
Mattias
More information about the Pas2js
mailing list