You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-12 22:07:39 +02:00
bug fix #68
This commit is contained in:
@ -74,10 +74,15 @@ type
|
||||
var
|
||||
JSExtensionWithObjectParameterFrm: TJSExtensionWithObjectParameterFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
uses
|
||||
uCEFMiscFunctions, uMyV8Handler;
|
||||
|
||||
// The CEF3 document describing JavaScript integration is here :
|
||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||
|
||||
@ -87,6 +92,33 @@ implementation
|
||||
// This demo is based in the code comments for the cef_register_extension function in the file
|
||||
// /include/capi/cef_v8_capi.h
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
var
|
||||
TempExtensionCode : string;
|
||||
TempHandler : ICefv8Handler;
|
||||
begin
|
||||
// This is the JS extension example with a function in the "JavaScript Integration" wiki page at
|
||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||
|
||||
TempExtensionCode := 'var test;' +
|
||||
'if (!test)' +
|
||||
' test = {};' +
|
||||
'(function() {' +
|
||||
' test.__defineGetter__(' + quotedstr('myparam') + ', function() {' +
|
||||
' native function GetMyParam();' +
|
||||
' return GetMyParam();' +
|
||||
' });' +
|
||||
' test.__defineSetter__(' + quotedstr('myparam') + ', function(b) {' +
|
||||
' native function SetMyParam();' +
|
||||
' if(b) SetMyParam(b);' +
|
||||
' });' +
|
||||
'})();';
|
||||
|
||||
TempHandler := TMyV8Handler.Create;
|
||||
|
||||
CefRegisterExtension('v8/test', TempExtensionCode, TempHandler);
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithObjectParameterFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
Reference in New Issue
Block a user