specific doubt on calling c++ from javascript

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

specific doubt on calling c++ from javascript

Postby giridharb54 » Thu Nov 28, 2013 4:24 pm

I am starting a new thread for this.So this is my basic understanding on v8 extensions.
Code: Select all
std::string extensionCode =
  "var test;"
  "if (!test)"
  "  test = {};"
  "(function() {"
  "  test.myfunc = function() {"
  "    native function myfunc();"
  "    return myfunc();"
  "  };"
  "})();";

// Create an instance of my CefV8Handler object.
CefRefPtr<CefV8Handler> handler = new MyV8Handler();

// Register the extension.
CefRegisterExtension("v8/test", extensionCode, handler);

the above code loads into the context for every frame. Also native function is called using the native keyword. My doubt is cant we call the native function from javascript ?? something like below
Code: Select all
<script language="JavaScript">
function myFunction()
{
     native function myfunc();
     myfunc();
}
</script>

here myfunc() is a native implementation in c++. I went through javascriptintegration and generalusage wikipages. it doesnt say anything about the question in this thread. if it is there in the wikipages please mention which part of the page and share some code snippets if possible.
giridharb54
Expert
 
Posts: 100
Joined: Thu Oct 17, 2013 2:15 am

Return to CEF Discussion

Who is online

Users browsing this forum: Majestic-12 [Bot] and 92 guests