It seems that Javascript naturally allows the passing of classes as a function parameter, but the transpiler is not able to transform the Delphi style to Javascript.
I've discovered a workaround to this limitation.
I've created a "type of class type".
It sounds complicated, but the essence is that they work.
type
TscForm = class of TscCustomWebForm;
TMainForm = class(TWebForm)
...
[async] procedure ShowModalForm(AFormClass :TscForm);
....
end;
implementation
procedure TMainForm.ShowModalForm(AFormClass :TscForm);
var ModalForm :TscCustomWebForm;
Modal :TModalResult;
begin
ModalForm := AFormClass.Create(Self);
ModalForm.Border := fbNone;
ModalForm.Popup := True;
ModalForm.WebSetup := FWebSetup;
await(TscCustomWebForm, ModalForm.Load());
TMisc.BlurStatus(True);
try
Modal := await(TModalResult, ModalForm.Execute);
if Modal = mrOK then begin
end;
finally
TMisc.BlurStatus(False);
ModalForm.Free;
end;
end;
Now, I can call this method in this form:
ShowModalForm(TCallUpsForm);
Note that TCallUpsForm is a class. Not an instance of a class.
TCallUpsForm descent of TscCustomWebForm, of course.
I have a method able to instantiate any descendant of TscCustomWebForm.