![]() |
UCefView
|
UCefView provides the capabilities of interoperability between native context and web context, thus the developer can call Javascript from C++ code easily, vice versa. This allows you to create hybrid applications that combine the power of web technologies with the capabilities of native C++ code.
UCefView inserts a bridge object into the web context displayed in all the frames and browsers managed by UCefView. The bridge object provides methods for communicating with native code. The bridge object is mounted at window object, and the object name could be configured through the UCefSettings::BridgeObjectName
field. The default name is UCefViewBridge
Members | Descriptions |
---|---|
window.UCefViewBridge.addEventListener(name, listener) | Adds a listener for the event with specified name |
window.UCefViewBridge.removeEventListener(name, listener) | Removes the listener for the event with specified name |
window.UCefViewBridge.invoke(name, ...args) | Invokes a native method with the specified name and arguments |
Adds a listener for the event with specified name
name
The event namelistener
The listener callback function Removes the listener for the event with specified name
name
The event namelistener
The listener callback functionInvokes a native method with the specified name and arguments
name
The method name..args
The arguments for the methodinvoke(name, ...args)
is ASYNCHRONOUS
operation, that means the calling from Javascript returns immediately regardless the execution of C++ code.UCefView added some extra methods to the window
object for all browsers frames, with these methods you can perform communication between native and web context
Members | Descriptions |
---|---|
window.cefViewQuery(query) | Sends a cef query request to the native context |
window.cefViewQueryCancel(id) | Cancels the query request with the specified id |
Sends a cef query request to the native context
query
The query objectCancels the query request with the specified id
id
The query idUCefView::ExecuteJavascript
UCefView::ExecuteJavascriptWithResult
SCefView::ExecuteJavascript
SCefView::ExecuteJavascriptWithResult
You can register an event from javascript code and then trigger the event from C++ code or Blueprint.
Register event handler in Javascript
Trigger the event from C++ or Blueprint
UCefView::TriggerEventForFrame
UCefView::TriggerEventForMainFrame
UCefView::BroadcastEvent
SCefView::TriggerEventForFrame
SCefView::TriggerEventForMainFrame
SCefView::BroadcastEvent
You can register an invoke handler from C++/Blueprint and then invoke the handler from Javascript.
Register invoke handler in C++/Blueprint
Invoke native handler from Javascript
you can register CefViewQuery handler to process the CefViewQuery request and reply with your response.
Register CefViewQuery handler in C++/Blueprint
Send CefViewQuery request from Javascript and process the response