From 40e5804f6661bfb23d79d7519f9356ba4d0a2c73 Mon Sep 17 00:00:00 2001 From: liyongzhuang Date: Mon, 28 Apr 2025 13:34:16 +0000 Subject: [PATCH] ndk jsb Signed-off-by: liyongzhuang --- .../interfaces/native/libohweb.ndk.json | 4 ++++ .../native/native_interface_arkweb.h | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/web/webview/interfaces/native/libohweb.ndk.json b/web/webview/interfaces/native/libohweb.ndk.json index 4981b04a4..aa5489f4a 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 7d40e22df..cdb6e5e2a 100644 --- a/web/webview/interfaces/native/native_interface_arkweb.h +++ b/web/webview/interfaces/native/native_interface_arkweb.h @@ -185,6 +185,24 @@ 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 -- Gitee