UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MobileJSScripting.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
5
6#if PLATFORM_ANDROID || PLATFORM_IOS || PLATFORM_MAC
7
8#include "WebJSFunction.h"
9#include "WebJSScripting.h"
10
12
15
20 : public FWebJSScripting
21 , public TSharedFromThis<FMobileJSScripting>
22{
23public:
24 static const FString JSMessageTag;
25 static const FString JSMessageHandler;
26
27 FMobileJSScripting(bool bJSBindingToLoweringEnabled, bool bInjectJSOnPageStarted, bool bDefaultJSReturnInDict);
28
29 virtual void BindUObject(const FString& Name, UObject* Object, bool bIsPermanent = true) override;
30 virtual void UnbindUObject(const FString& Name, UObject* Object = nullptr, bool bIsPermanent = true) override;
31 void BindUObject(const TSharedRef<class IWebBrowserWindow>& InWindow, const FString& Name, UObject* Object, bool bIsPermanent = true);
32 void UnbindUObject(const TSharedRef<class IWebBrowserWindow>& InWindow, const FString& Name, UObject* Object = nullptr, bool bIsPermanent = true);
33
41 bool OnJsMessageReceived(const FString& Command, const TArray<FString>& Params, const FString& Origin);
42
43 FString ConvertStruct(UStruct* TypeInfo, const void* StructPtr);
44 FString ConvertObject(UObject* Object);
45
46 virtual void InvokeJSFunction(FGuid FunctionId, int32 ArgCount, FWebJSParam Arguments[], bool bIsError=false) override;
47 virtual void InvokeJSErrorResult(FGuid FunctionId, const FString& Error) override;
48 void PageStarted(const TSharedRef<class IWebBrowserWindow>& InWindow); // Called when page load started
49 void PageLoaded(const TSharedRef<class IWebBrowserWindow>& InWindow); // Called on page completely loaded
50 void SetWindow(const TSharedRef<class IWebBrowserWindow>& InWindow);
51
52private:
55 void InvokeJSFunctionRaw(FGuid FunctionId, const FString& JSValue, bool bIsError=false);
56 bool IsValid()
57 {
58 return WindowPtr.Pin().IsValid();
59 }
60 void AddPermanentBind(const FString& Name, UObject* Object);
61 void RemovePermanentBind(const FString& Name, UObject* Object);
62
65 bool HandleExecuteUObjectMethodMessage(const TArray<FString>& Params);
66
69
73};
74
75#endif // PLATFORM_ANDROID || PLATFORM_IOS || PLATFORM_MAC
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
Definition WebJSScripting.h:17
virtual void InvokeJSErrorResult(FGuid FunctionId, const FString &Error)=0
virtual void InvokeJSFunction(FGuid FunctionId, int32 ArgCount, FWebJSParam Arguments[], bool bIsError=false)=0
virtual void UnbindUObject(const FString &Name, UObject *Object=nullptr, bool bIsPermanent=true)=0
virtual void BindUObject(const FString &Name, UObject *Object, bool bIsPermanent=true)=0
Definition Array.h:670
Definition SharedPointer.h:1640
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition SharedPointer.h:1295
Definition Object.h:95
Definition Class.h:480
Definition Guid.h:109
Definition WebJSFunction.h:26