UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FWebJSResponse Struct Reference

#include <WebJSFunction.h>

+ Inheritance diagram for FWebJSResponse:

Public Member Functions

 FWebJSResponse ()
 
 FWebJSResponse (TSharedPtr< FWebJSScripting > InScripting, const FGuid &InCallbackId)
 
void Success () const
 
template<typename T >
void Success (T Arg) const
 
template<typename T >
void Failure (T Arg) const
 
- Public Member Functions inherited from FWebJSCallbackBase
 FWebJSCallbackBase ()
 
bool IsValid () const
 

Additional Inherited Members

- Protected Member Functions inherited from FWebJSCallbackBase
 FWebJSCallbackBase (TSharedPtr< FWebJSScripting > InScripting, const FGuid &InCallbackId)
 
WEBBROWSER_API void Invoke (int32 ArgCount, FWebJSParam Arguments[], bool bIsError=false) const
 

Detailed Description

Representation of a remote JS async response object. UFUNCTIONs taking a FWebJSResponse will get it passed in automatically when called from a web browser. Pass a result or error back by invoking Success or Failure on the object. UFunctions accepting a FWebJSResponse should have a void return type, as any value returned from the function will be ignored. Calling the response methods does not have to happen before returning from the function, which means you can use this to implement asynchronous functionality.

Note that the remote object will become invalid as soon as a result has been delivered, so you can only call either Success or Failure once.

Constructor & Destructor Documentation

◆ FWebJSResponse() [1/2]

FWebJSResponse::FWebJSResponse ( )
inline

◆ FWebJSResponse() [2/2]

FWebJSResponse::FWebJSResponse ( TSharedPtr< FWebJSScripting InScripting,
const FGuid InCallbackId 
)
inline

Member Function Documentation

◆ Failure()

template<typename T >
void FWebJSResponse::Failure ( Arg) const
inline

Indicate failed completion, passing an error message back to JS. The remote Promise's catch() handler will be executed with the value passed as the error reason.

◆ Success() [1/2]

void FWebJSResponse::Success ( ) const
inline

Indicate successful completion without a return value. The remote Promise's then() handler will be executed without arguments.

◆ Success() [2/2]

template<typename T >
void FWebJSResponse::Success ( Arg) const
inline

Indicate successful completion passing a return value back. The remote Promise's then() handler will be executed with the value passed as its single argument.


The documentation for this struct was generated from the following file: