[Pas2js] Object literals?
Mattias Gaertner
nc-gaertnma at netcologne.de
Sun Jun 3 07:54:42 CEST 2018
On Sun, 3 Jun 2018 07:44:22 +0200
Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
> On Sun, 3 Jun 2018 09:55:41 +0700
> Ryan Joseph <ryan at thealchemistguild.com> wrote:
>
> > can you make object literals (I think that’s what they’re called)/associative arrays/dictionaries in pas2js? Somehow I didn’t come across that in the short time I used it. I know I can make a record but it should be possible using JSArray I thought (I was told the index of an array can be a string or other type).
> >
> > d = { items: [], text: '’ };
>
> Maybe this helps:
> http://wiki.freepascal.org/pas2js#Create_simple_JS_objects_with_the_new_function
Btw, Michael, what do you think of adding a similar function with
varargs instead of TJSValueDynArray? Then the [] can be omitted.
Of course it cannot be named 'new'. Perhaps "NewJSObj"?
Mattias
More information about the Pas2js
mailing list