Browse Source

* Add constructor to TJSArray that accepts array of const

Michaël Van Canneyt 1 year ago
parent
commit
dbc3d6b98f
1 changed files with 6 additions and 0 deletions
  1. 6 0
      packages/wasm-job/src/job.js.pas

+ 6 - 0
packages/wasm-job/src/job.js.pas

@@ -616,6 +616,7 @@ type
     procedure _SetElements(Index: NativeInt; const AValue: TJOB_JSValue);
     procedure _SetElements(Index: NativeInt; const AValue: TJOB_JSValue);
     procedure _SetLength(const AValue: NativeInt);
     procedure _SetLength(const AValue: NativeInt);
   public
   public
+    constructor Create(aArgs : Array of const); overload;
     function isArray(a: TJOB_JSValue): Boolean; overload;
     function isArray(a: TJOB_JSValue): Boolean; overload;
     function concat(el: TJOB_JSValue): IJSArray; overload; {varargs;}
     function concat(el: TJOB_JSValue): IJSArray; overload; {varargs;}
     //function copyWithin(aTarget: NativeInt): IJSArray;overload; // not in IE
     //function copyWithin(aTarget: NativeInt): IJSArray;overload; // not in IE
@@ -1600,6 +1601,11 @@ begin
   WriteJSPropertyLongInt('length',AValue);
   WriteJSPropertyLongInt('length',AValue);
 end;
 end;
 
 
+constructor TJSArray.Create(aArgs: array of const);
+begin
+  JOBCreate(aArgs);
+end;
+
 function TJSArray.isArray(a: TJOB_JSValue): Boolean;
 function TJSArray.isArray(a: TJOB_JSValue): Boolean;
 begin
 begin
   Result:=InvokeJSBooleanResult('isArray',[a]);
   Result:=InvokeJSBooleanResult('isArray',[a]);