UObject Script Integration Test Page

Objects registered on page init window.ue:

Below, we demonstrate callback methods. On page init, we register a javascript function callback with C++ that is intended to be called when we increment a counter. When the increment page button is pressed, we make a blocking call to a C++ JSBridge method to increment the counter that is stored on the C++ side only. During execution of the C++ method, the counter is incremented and the registered JS callback method is called with the new counter value.

Count: unknown -press the increment button to update.


Below, we demonstrate data transport between javascript objects and UE side UObject/UStruct. The text field below is initially populated with the UObject/UStruct values. Updating the displayed JSON in the text field and clicking save will cause the UObject/UStruct data to be updated in C++. That data is then read by javascript and re-displayed in the textbox. In this demonstration we use a number of basic UE types like int, double, FString, FText, FName, TArray.





In the read-only text area below, we demonstrate completion (or failure) of an asynchronous operation and its resulting value. We do this with the help of JS promise and the corresponding FWebJSResponse in C++. Above, we retrieve/save struct data via blocking methods, here we retrieve the same C++ struct data async.







Below, we demonstrate a potential issue with pre-initialized arrays in a struct. Each round trip from JS to UObject and back results in the new data we are trying to set being appended to the data initialized in the array. This is not demonstrated by arrays when individually but does when they are initialized in struct constructor. This is not expected as we would expect the JS value overwrite the array values instead of appending to them. We don't see this behavior if the array is not initialized.



Command Output: