Open GoogleCodeExporter opened 9 years ago
verified
Original comment by lmf1...@gmail.com
on 6 Aug 2013 at 1:14
Strangely, BUT this code work fine:
// .....
type
TMyExtension = class(TThread) // or just class, (extension code execute in thread)
class function call(const arg1, arg2: ICefv8Value): string;
end;
TCustomRenderProcessHandler = class(TCefRenderProcessHandlerOwn)
protected
procedure OnWebKitInitialized; override;
end;
implementation
// .....
procedure TCustomRenderProcessHandler.OnWebKitInitialized;
begin
{In webPage <script> alert( MyEXT.call('arg1', 'arg2') ); <script>}
TCefRTTIExtension.Register('MyEXT', TMyExtension);
end;
class function TMyExtension.call;
begin
// some code
result := 'result from Delphi XE2: ' + arg1.GetStringValue;
end
initialization
CefRenderProcessHandler := TCustomRenderProcessHandler.Create;
end.
-------------------------------------------
To add MyEXT.SomeAnotherFunc() in js, just add
class function TMyExtension.SomeAnotherFunc;
Original comment by vGhost2...@gmail.com
on 6 Aug 2013 at 5:36
And I think this is more scalable than using CefRegisterExtension.
The issue may be closed.
Original comment by vGhost2...@gmail.com
on 6 Aug 2013 at 5:47
class function hello: ICefv8value;
ret := TCefv8ValueRef.NewArray(2);
ret.SetValueByIndex(0,TCefv8ValueRef.NewString('qwe'));
ret.SetValueByIndex(1,TCefv8ValueRef.NewString('asd'));
result := TCefv8ValueRef.NewObject(nil);
result.SetUserData(ret);
on return empty object
Original comment by amphilim...@gmail.com
on 21 Aug 2014 at 4:53
Original issue reported on code.google.com by
vGhost2...@gmail.com
on 8 Jul 2013 at 9:32