- 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.