[Pas2js] Next language feature for pas2js...

warleyalex warleyalex at yahoo.com.br
Fri Apr 27 14:23:50 CEST 2018


I'm quite confident our mORMot suits better with the free open source Pas2JS
FPC based project. 
Now, I think it is technically feasible to integrate mORMot and implement
the client Pas2JS wrappers. This client wrapper is generated on the fly to
allow safe and efficient access to a mORMot server.

The class is able to: 
· Handle security.
· Perform all the CRUD operations (delete, update, add and get) with ORM
records.
· It is able to execute remote methods, including the usage of var and out
parameters.
-------------------------------
One important feature is missing: lambda / anonymous functions.

for instance:

procedure GetClient(const aServerAddress, aUserName,aPassword: string;
  onSuccess, onError: TSQLRestEvent; aServerPort: integer; aServerRoot:
string;
  aHttps: boolean);
begin
  var client := TSQLRestClientHTTP.Create(aServerAddress,aServerPort,
    GetModel(aServerRoot),true,aHttps); 
  client.Connect(
  lambda
    try
      if client.ServerTimeStamp=0 then begin
        if Assigned(onError) then
          onError(client);
        exit;
      end;
      if not
client.SetUser(TSQLRestServerAuthenticationDefault,aUserName,aPassword) then
begin
        if Assigned(onError) then
          onError(client);
        exit;
      end;
      if Assigned(onSuccess) then
        onSuccess(client);
    except
      if Assigned(onError) then
        onError(client);
    end;
  end,
  onError);
end;



--
Sent from: http://pas2js.38893.n8.nabble.com/


More information about the Pas2js mailing list