mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-09 07:27:46 +02:00
* Add event to set up request
This commit is contained in:
parent
6a4925eee2
commit
59b0fb327f
@ -29,11 +29,14 @@ Type
|
||||
{ TRESTConnection }
|
||||
TRestGetURLEvent = Procedure (Sender : TComponent; aRequest : TDataRequest; Var aURL : String) of Object;
|
||||
TRestUpdateURLEvent = Procedure (Sender : TComponent; aRequest : TRecordUpdateDescriptor; Var aURL : String) of Object;
|
||||
TSetupHTTPRequestEvent = Procedure (Sender : TComponent; aHTTPRequest : TJSXMLHttpRequest) of Object;
|
||||
|
||||
TRESTConnection = Class(TComponent)
|
||||
private
|
||||
FBaseURL: String;
|
||||
FDataProxy : TDataProxy;
|
||||
FOnGetURL: TRestGetURLEvent;
|
||||
FOnSetupHTTPRequest: TSetupHTTPRequestEvent;
|
||||
FOnUpdateURL: TRestUpdateURLEvent;
|
||||
FPageParam: String;
|
||||
function GetDataProxy: TDataProxy;
|
||||
@ -46,6 +49,7 @@ Type
|
||||
Public
|
||||
Function DoGetDataProxy : TDataProxy; virtual;
|
||||
Public
|
||||
Property OnSetupHTTPRequest : TSetupHTTPRequestEvent Read FOnSetupHTTPRequest Write FOnSetupHTTPRequest;
|
||||
Property DataProxy : TDataProxy Read GetDataProxy;
|
||||
Property BaseURL : String Read FBaseURL Write FBaseURL;
|
||||
Property PageParam : String Read FPageParam Write FPageParam;
|
||||
@ -148,8 +152,8 @@ end;
|
||||
|
||||
procedure TRESTConnection.SetupRequest(aXHR: TJSXMLHttpRequest);
|
||||
begin
|
||||
// Do nothing
|
||||
if aXHR=nil then ;
|
||||
if (aXHR<>nil) and Assigned(FOnSetupHTTPRequest) then
|
||||
FOnSetupHTTPRequest(Self,aXHR);
|
||||
end;
|
||||
|
||||
function TRESTConnection.GetUpdateBaseURL(aRequest: TRecordUpdateDescriptor): String;
|
||||
|
Loading…
Reference in New Issue
Block a user