Can you please explain whether it is possible:
-to call c++ callback from js code and
-return the value of a variable from js to c++ code?
1.For example:
- Code: Select all
(*frame).ExecuteJavaScript("window.addEventListener('click', function(event){alert(event.pageX + \":\" + (event.pageY))}, false)", "", 1);
it is possible:
-to call c++ callback from js code ?
-return the value of a variable event.pageX from js to c++ variable ?
2.Or such an example:
- Code: Select all
void OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) override
{
CefRefPtr<CefV8Value> object = context->GetGlobal();
CefRefPtr<CefV8Value> int_ = CefV8Value::CreateInt(555);
object->SetValue("my_int", int_, V8_PROPERTY_ATTRIBUTE_NONE);
(*frame).ExecuteJavaScript("my_int = 777; alert(my_int,false)", "", 1);
std::cout <<"my_int:" << (*int_).GetIntValue() << std::endl; //What needs to be done so that the "int_" has the value 777 changed in the js code?
}
I am reading this description: https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
But I still can't figure out if it's possible to do this or not.