UCefView
Loading...
Searching...
No Matches
UCefViewEvent

Represents an event dispatched from the CEF (Chromium Embedded Framework) view to the Unreal Engine environment. More...

#include <CefViewEvent.h>

Public Member Functions

FString GetArguments () const
 Gets the arguments associated with this event in JSON string format.
 
void SetArguments (const FString &InArguments)
 Sets the arguments for this event using a JSON string.
 

Public Attributes

FString Name
 The name of the event as dispatched from the browser.
 
TArray< TSharedPtr< FJsonValue > > Arguments
 The parsed arguments associated with the event, represented as an array of JSON values.
 

Detailed Description

Represents an event dispatched from the CEF (Chromium Embedded Framework) view to the Unreal Engine environment.

UCefViewEvent encapsulates the name and arguments of an event sent from JavaScript running in a CEF browser instance to the Unreal Engine application. This enables seamless communication between web content and native game logic, allowing you to handle browser-originated events in both Blueprints and C++.

Events are typically triggered from JavaScript using a bridge object, and received in Unreal as instances of this class.

Example usage in Blueprint:

Event OnCefViewEventReceived(UCefViewEvent* Event)
{
PrintString(Event->Name);
PrintString(Event->GetArguments());
}
Represents an event dispatched from the CEF (Chromium Embedded Framework) view to the Unreal Engine e...
Definition CefViewEvent.h:50
FString Name
The name of the event as dispatched from the browser.
Definition CefViewEvent.h:71
FString GetArguments() const
Gets the arguments associated with this event in JSON string format.

Member Function Documentation

◆ GetArguments()

FString UCefViewEvent::GetArguments ( ) const

Gets the arguments associated with this event in JSON string format.

Returns
A string representing the arguments as a JSON array (e.g., [1, "foo", true]).

Use this method to retrieve the raw arguments as sent from the browser. The returned string is a JSON-encoded array, which can be parsed for further processing or inspection.

For structured access to individual arguments, use the Arguments property.

◆ SetArguments()

void UCefViewEvent::SetArguments ( const FString & InArguments)

Sets the arguments for this event using a JSON string.

Parameters
InArgumentsA string representing the arguments as a JSON array (e.g., [1, "foo", true]).

This method parses the provided JSON string and updates the Arguments property accordingly. The input must be a valid JSON array; otherwise, parsing will fail and the arguments will not be updated.

Use this to populate the event with data received from the browser or to simulate events in tests.

Member Data Documentation

◆ Arguments

TArray<TSharedPtr<FJsonValue> > UCefViewEvent::Arguments

The parsed arguments associated with the event, represented as an array of JSON values.

Each element in the array corresponds to an argument passed from the browser, and can be a number, string, boolean, object, or array, depending on the data sent from JavaScript.

This property is automatically updated when SetArguments is called, and is used internally by GetArguments to serialize the arguments back to a JSON string.

Use this property for type-safe access to individual arguments in C++.

◆ Name

FString UCefViewEvent::Name

The name of the event as dispatched from the browser.

This string identifies the type or purpose of the event (e.g., "OnButtonClick", "DataReceived"). It is set by the JavaScript code in the web view and is used to route or handle events in Unreal.

Typical values correspond to custom event names defined in your web application.