[Pas2js] pas2js Webgl unit committed

Michael Van Canneyt michael at freepascal.org
Wed May 9 12:48:49 CEST 2018



On Wed, 9 May 2018, Mattias Gaertner wrote:

> On Wed, 9 May 2018 16:34:35 +0700
> Ryan Joseph <ryan at thealchemistguild.com> wrote:
>
>> [...]
>> 2) what’s the deal with arrays? I saw there is array of xxx syntax for dynamic arrays. Can we use static arrays also and do they work with new Float32Array(xxx)? I guess all JS arrays are the same and I can pass them like
>
> pas2js supports dynamic arrays, static arrays, open arrays and array
> constants. It does not yet support the Delphi XE array literals (e.g.
> a:=[1,1,2,2]).
> They all translate to JS arrays and you can type cast them to TJSArray.
>
> var a: TJSFloat32Array;
> begin
>  a:=TJSFloat32Array(TJSFloat32Array.from(anyArray));
> end;
>
> Michael, since typedarray is an abstract class, maybe it would be better
> to move/copy the methods from typedarray to the real types?

Probably the from() class functions and the new() constructor should be
added to the descendents, yes.

Michael.


More information about the Pas2js mailing list