openharmony 鸿蒙 capi-arkweb-type-h

2026-08-25 浏览 (1)

arkweb_type.h

Overview

Defines the native common types of ArkWeb.

File to include: <web/arkweb_type.h>

Library: libohweb.so

System capability: SystemCapability.Web.Webview.Core

Since: 12

Related module: Web

Summary

Structs

Nametypedef KeywordDescription
ArkWeb_JavaScriptBridgeDataArkWeb_JavaScriptBridgeDataDefines the JavaScript Bridge data.
ArkWeb_WebMessage*ArkWeb_WebMessagePtrDefines a pointer to the post message.
ArkWeb_JavaScriptValue*ArkWeb_JavaScriptValuePtrDefines a pointer to the JavaScript data.
ArkWeb_WebMessagePort*ArkWeb_WebMessagePortPtrDefines a pointer to the message port.
ArkWeb_JavaScriptObjectArkWeb_JavaScriptObjectDefines a JavaScript object to inject.
ArkWeb_ProxyMethodArkWeb_ProxyMethodDefines a proxy method to inject.
ArkWeb_ProxyMethodWithResultArkWeb_ProxyMethodWithResultDefines a proxy method with result to inject.
ArkWeb_ProxyObjectArkWeb_ProxyObjectDefines a proxy object to inject.
ArkWeb_ProxyObjectWithResultArkWeb_ProxyObjectWithResultDefines a proxy object with result to inject.
ArkWeb_ControllerAPIArkWeb_ControllerAPIDefines a native controller API. Before calling the API, you are advised to use ARKWEB_MEMBER_MISSING to check whether the function struct has the corresponding pointer to avoid crash caused by mismatch between the SDK and the device ROM. The controller APIs must be called on the UI thread through OH_ArkWeb_GetNativeAPI.
ArkWeb_ComponentAPIArkWeb_ComponentAPIDefines a native component API.
ArkWeb_WebMessagePortAPIArkWeb_WebMessagePortAPIDefines a native message port API. Before calling the API, you are advised to use ARKWEB_MEMBER_MISSING to check whether the function struct has the corresponding pointer to avoid crash caused by mismatch between the SDK and the device ROM. The WebMessagePort APIs must be called on the UI thread through OH_ArkWeb_GetNativeAPI.
ArkWeb_WebMessageAPIArkWeb_WebMessageAPIDefines a native post message API. Before calling the API, you are advised to use ARKWEB_MEMBER_MISSING to check whether the function struct has the corresponding pointer to avoid crash caused by mismatch between the SDK and the device ROM. The WebMessage APIs must be called on the UI thread through OH_ArkWeb_GetNativeAPI.
ArkWeb_CookieManagerAPIArkWeb_CookieManagerAPIDefines the CookieManager API of ArkWeb. Before calling the API, you are advised to use ARKWEB_MEMBER_MISSING to check whether the function struct has the corresponding pointer to avoid crash caused by mismatch between the SDK and the device ROM. The CookieManager APIs must be called on the UI thread through OH_ArkWeb_GetNativeAPI.
ArkWeb_JavaScriptValueAPIArkWeb_JavaScriptValueAPIDefines the JavaScriptValue API of ArkWeb. Before calling the API, you are advised to use ARKWEB_MEMBER_MISSING to check whether the function struct has the corresponding pointer to avoid crash caused by mismatch between the SDK and the device ROM.

Enums

Nametypedef KeywordDescription
ArkWeb_WebMessageTypeArkWeb_WebMessageTypeEnumerates the data types of post message.
ArkWeb_JavaScriptValueTypeArkWeb_JavaScriptValueTypeEnumerates the JavaScript data types.

Functions

Nametypedef KeywordDescription
typedef void (*ArkWeb_OnJavaScriptCallback)(const char* webTag, const ArkWeb_JavaScriptBridgeData* data, void* userData)ArkWeb_OnJavaScriptCallbackCalled when the injected JavaScript is executed.
typedef void (*ArkWeb_OnJavaScriptProxyCallback)(const char* webTag, const ArkWeb_JavaScriptBridgeData* dataArray, size_t arraySize, void* userData)ArkWeb_OnJavaScriptProxyCallbackCalled when the proxy method is executed.
typedef ArkWeb_JavaScriptValuePtr (*ArkWeb_OnJavaScriptProxyCallbackWithResult)(const char* webTag, const ArkWeb_JavaScriptBridgeData* dataArray, size_t arraySize, void* userData)ArkWeb_OnJavaScriptProxyCallbackWithResultCalled when the proxy method is executed.
typedef void (*ArkWeb_OnComponentCallback)(const char* webTag, void* userData)ArkWeb_OnComponentCallbackCalled when a component event notification is sent.
typedef void (*ArkWeb_OnScrollCallback)(const char* webTag, void* userData, double x, double y)ArkWeb_OnScrollCallbackCalled when the Web component is scrolled.
typedef void (*ArkWeb_OnMessageEventHandler)(const char* webTag, const ArkWeb_WebMessagePortPtr port, const ArkWeb_WebMessagePtr message, void* userData)ArkWeb_OnMessageEventHandlerCalled when a post message is sent from the HTML page.

Macros

NameDescription
ARKWEB_MEMBER_EXISTS(s, f)    ((intptr_t) & ((s)->f) - (intptr_t)(s) + sizeof((s)->f) <= *reinterpret_cast<size_t*>(s))Whether a member variable exists in the struct.
Since: 12
ARKWEB_MEMBER_MISSING(s, f)   (!ARKWEB_MEMBER_EXISTS(s, f) ||!((s)->f))If the member variable exists in the struct, false is returned. Otherwise, true is returned.
Since: 12

Enum Description

ArkWeb_WebMessageType

enum ArkWeb_WebMessageType

Description

Enumerates the data types of post message.

Since: 12

Enumerated ValueDescription
ARKWEB_NONE = 0Error data.
ARKWEB_STRINGString data.
ARKWEB_BUFFERByte stream data.

ArkWeb_JavaScriptValueType

enum ArkWeb_JavaScriptValueType

Description

Enumerates the JavaScript data types.

Since: 18

Enumerated ValueDescription
ARKWEB_JAVASCRIPT_NONE = 0Error data.
ARKWEB_JAVASCRIPT_STRINGString data.
ARKWEB_JAVASCRIPT_BOOLBoolean data.

Function Description

ArkWeb_OnJavaScriptCallback()

typedef void (*ArkWeb_OnJavaScriptCallback)(const char* webTag, const ArkWeb_JavaScriptBridgeData* data, void* userData)

Description

Called when the injected JavaScript is executed.

Since: 12

Parameters

NameDescription
const char* webTagName of the Web component.
const ArkWeb_JavaScriptBridgeData* dataJavaScriptBridge data.
void* userDataPointer to user-defined data.

ArkWeb_OnJavaScriptProxyCallback()

typedef void (*ArkWeb_OnJavaScriptProxyCallback)(const char* webTag, const ArkWeb_JavaScriptBridgeData* dataArray, size_t arraySize, void* userData)

Description

Called when the proxy method is executed.

Since: 12

Parameters

NameDescription
const char* webTagName of the Web component.
const ArkWeb_JavaScriptBridgeData* dataArrayPointer to data array.
size_t arraySizeArray size.
void* userDataPointer to user-defined data.

ArkWeb_OnJavaScriptProxyCallbackWithResult()

typedef ArkWeb_JavaScriptValuePtr (*ArkWeb_OnJavaScriptProxyCallbackWithResult)(const char* webTag, const ArkWeb_JavaScriptBridgeData* dataArray, size_t arraySize, void* userData)

Description

Called when the proxy method is executed.

Since: 18

Parameters

NameDescription
const char* webTagName of the Web component.
const ArkWeb_JavaScriptBridgeData* dataArrayPointer to data array.
size_t arraySizeArray size.
void* userDataPointer to user-defined data.

ArkWeb_OnComponentCallback()

typedef void (*ArkWeb_OnComponentCallback)(const char* webTag, void* userData)

Description

Called when a component event notification is sent.

Since: 12

Parameters

NameDescription
const char* webTagName of the Web component.
void* userDataPointer to user-defined data.

ArkWeb_OnScrollCallback()

typedef void (*ArkWeb_OnScrollCallback)(const char* webTag, void* userData, double x, double y)

Description

Called when the Web component is scrolled.

Since: 18

Parameters

NameDescription
const char* webTagName of the Web component.
void* userDataPointer to user-defined data.
double xScrolling offset of the X axis.
double yScrolling offset of the Y axis.

ArkWeb_OnMessageEventHandler()

typedef void (*ArkWeb_OnMessageEventHandler)(const char* webTag, const ArkWeb_WebMessagePortPtr port, const ArkWeb_WebMessagePtr message, void* userData)

Description

Called when a post message is sent from the HTML page.

Since: 12

Parameters

NameDescription
const char* webTagName of the Web component.
const ArkWeb_WebMessagePortPtr portPost message port.
const ArkWeb_WebMessagePtr messagePost message data.
void* userDataPointer to user-defined data.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-webview-WebviewController

openharmony 鸿蒙 arkts-apis-webview-t

openharmony 鸿蒙 arkts-apis-webview

openharmony 鸿蒙 arkts-basic-components-web-FullScreenExitHandler

openharmony 鸿蒙 arkts-apis-webview-WebDownloadManager

openharmony 鸿蒙 arkts-basic-components-web-VerifyPinHandler

openharmony 鸿蒙 capi-web-arkweb-webmessage8h

openharmony 鸿蒙 arkts-apis-webview-NativeMediaPlayerHandler

openharmony 鸿蒙 capi-web-arkweb-proxymethodwithresult

openharmony 鸿蒙 arkts-basic-components-web-WebResourceError

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/dRYo9mgC