Code Monkey home page Code Monkey logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 1, 2024
verified

Original comment by [email protected] on 6 Aug 2013 at 1:14

from dcef3.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 1, 2024
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 [email protected] on 6 Aug 2013 at 5:36

from dcef3.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 1, 2024
And I think this is more scalable than using CefRegisterExtension.
The issue may be closed.

Original comment by [email protected] on 6 Aug 2013 at 5:47

from dcef3.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 1, 2024
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 [email protected] on 21 Aug 2014 at 4:53

from dcef3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.