I'd like to create a CustomEvent object within a V8 context. I tried using .create() but the browser doesn't let me create it that way. Can you call the new operator from within CEF?
This was what I tried to invoke it with:
(C++ code)
CefRefPtr<CefV8Value> globalObj = context->GetGlobal();
CefRefPtr<CefV8Value> customEvent = globalObj->GetValue("CustomEvent");
CefRefPtr<CefV8Value> prototype = customEvent->GetValue("prototype");
CefV8ValueList prototypeArgs;
prototypeArgs.push_back(prototype);
prototypeArgs.push_back();
CefRefPtr<CefV8Value> object = globalObj->GetValue("Object");
CefRefPtr<CefV8Value> create = object->GetValue("create");
CefRefPtr<CefV8Value> event = create->ExecuteFunction(NULL, prototypeArgs);
I really want to just have a easy way from C++ to call
(Javascript Code)
new CustomEvent("test");
Use CefV8Context::Eval to execute the javascript code you need.
CefRefPtr<CefV8Value> returnValue;
CefRefPtr<CefV8Exception> exception;
context->Eval("new CustomEvent('test');", returnValue, exception);