diff --git a/web/webview/interfaces/native/libohweb.ndk.json b/web/webview/interfaces/native/libohweb.ndk.json index 4981b04a45e2d152ae6c0f77f133a157153c29d4..aa5489f4a60969a0f9b0a32117d34259de74d385 100644 --- a/web/webview/interfaces/native/libohweb.ndk.json +++ b/web/webview/interfaces/native/libohweb.ndk.json @@ -322,5 +322,9 @@ { "first_introduced": "18", "name": "OH_ArkWeb_RegisterScrollCallback" + }, + { + "first_introduced": "20", + "name": "OH_NativeArkWeb_RegisterAsyncThreadJavaScriptProxy" } ] diff --git a/web/webview/interfaces/native/native_interface_arkweb.h b/web/webview/interfaces/native/native_interface_arkweb.h index 7d40e22df06a3d600a5ce666932afef69adc2b32..8fdc2ce95db946e7b82a5a9fdf4c463e7907100b 100644 --- a/web/webview/interfaces/native/native_interface_arkweb.h +++ b/web/webview/interfaces/native/native_interface_arkweb.h @@ -36,6 +36,7 @@ #include #include "arkweb_error_code.h" +#include "arkweb_type.h" #ifdef __cplusplus extern "C" { @@ -185,6 +186,23 @@ ArkWeb_ErrorCode OH_NativeArkWeb_LoadData(const char* webTag, const char* baseUrl, const char* historyUrl); +/** + * @brief Register a JavaScript object with callback methods, which may return values. This object will be injected + * into all frames of the current page, including all iframes, and will be accessible using the specified + * name in ArkWeb_ProxyObjectWithResult. The object will only be available in JavaScript after the next + * load or reload. + * These methods will be executed in the ArkWeb worker thread. + * + * @param webTag The name of the web component. + * @param proxyObject The JavaScript object to register, the object has callback functions with return value. + * @param permission The JSON string, which defaults to null, is used to configure the permission control for + * JSBridge, allowing for the definition of URL whitelists at the object and method levels. + * + * @since 20 + */ +void OH_NativeArkWeb_RegisterAsyncThreadJavaScriptProxy(const char* webTag, + const ArkWeb_ProxyObjectWithResult* proxyObject, const char* permission); + #ifdef __cplusplus }; #endif