Hi,
Hi, I'm trying to use a lib in my pas2js project, but I'm not able to make it work.
I'm triyng to use the snippet below:
const myPromisse = MyPromisseInit();
myPromisse.then((data) => {
const temp = new data.SomeConstructor();
})
My pascal code is as follows:
program Project1;
{$mode objfpc}
{$modeswitch externalclass}
uses
JS;
type
TData = class external name 'Object' (TJSObject)
public
constructor SomeConstructor();
end;
function MyPromisseInit(): TJSPromise external name 'MyPromisseInit';
var
test: TJSPromise;
begin
test := MyPromisseInit();
test._then(function (data: JSValue): JSValue
var
_data: TData absolute data;
res: JSValue;
begin
res := _data.SomeConstructor();
end);
end.
But it did not work.
Compile says
project1.lpr(27,18) Error: External class instance cannot access static constructor SomeConstructorWhat I have to change to make it work?
Edited the pascal snippet with complete code.