These are examples from the Delphi standard library.
FMX.WebBrowser.Win.pas
procedure TEdgeWebBrowserPresentation.EvaluateJavascript(const AJavascript: string; const AValueCallback: TJavaScriptResultCallback);
begin
if FWebView <> nil then
begin
FWebView.ExecuteScript(PWideChar(AJavascript),
Callback<HResult, PWideChar>.CreateAs<ICoreWebView2ExecuteScriptCompletedHandler>(
function(ErrorCode: HResult; ResultObjectAsJson: PWideChar): HResult stdcall
var
JavascriptResult: string;
begin
Result := S_OK;
JavascriptResult := string(ResultObjectAsJson);
DoJavascriptEvaluated(ErrorCode, JavascriptResult);
if Assigned(AValueCallback) then
AValueCallback(JavascriptResult);
end
)
);
end;
end;
Winapi.EdgeUtils.pas:
type
TCbStdProc1<T1> = reference to function(const P1: T1): HResult stdcall;
TCbStdProc2<T1, T2> = reference to function(const P1: T1; const P2: T2): HResult stdcall;
TCbStdProc3<T1, T2> = reference to function(P1: T1; P2: T2): HResult stdcall;
TCbStdProc4<T1, T2> = reference to function(P1: T1; const P2: T2): HResult stdcall;
TCbStdMethod1<T1> = function(P1: T1): HResult of object stdcall;
TCbStdMethod2<T1, T2> = function(P1: T1; const P2: T2): HResult of object stdcall;
These are examples from the Delphi standard library.
FMX.WebBrowser.Win.pas
Winapi.EdgeUtils.pas: