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
| Name | typedef Keyword | Description |
|---|---|---|
| ArkWeb_JavaScriptBridgeData | ArkWeb_JavaScriptBridgeData | Defines the JavaScript Bridge data. |
| ArkWeb_WebMessage* | ArkWeb_WebMessagePtr | Defines a pointer to the post message. |
| ArkWeb_JavaScriptValue* | ArkWeb_JavaScriptValuePtr | Defines a pointer to the JavaScript data. |
| ArkWeb_WebMessagePort* | ArkWeb_WebMessagePortPtr | Defines a pointer to the message port. |
| ArkWeb_JavaScriptObject | ArkWeb_JavaScriptObject | Defines a JavaScript object to inject. |
| ArkWeb_ProxyMethod | ArkWeb_ProxyMethod | Defines a proxy method to inject. |
| ArkWeb_ProxyMethodWithResult | ArkWeb_ProxyMethodWithResult | Defines a proxy method with result to inject. |
| ArkWeb_ProxyObject | ArkWeb_ProxyObject | Defines a proxy object to inject. |
| ArkWeb_ProxyObjectWithResult | ArkWeb_ProxyObjectWithResult | Defines a proxy object with result to inject. |
| ArkWeb_ControllerAPI | ArkWeb_ControllerAPI | Defines 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_ComponentAPI | ArkWeb_ComponentAPI | Defines a native component API. |
| ArkWeb_WebMessagePortAPI | ArkWeb_WebMessagePortAPI | Defines 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_WebMessageAPI | ArkWeb_WebMessageAPI | Defines 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_CookieManagerAPI | ArkWeb_CookieManagerAPI | Defines 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_JavaScriptValueAPI | ArkWeb_JavaScriptValueAPI | Defines 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
| Name | typedef Keyword | Description |
|---|---|---|
| ArkWeb_WebMessageType | ArkWeb_WebMessageType | Enumerates the data types of post message. |
| ArkWeb_JavaScriptValueType | ArkWeb_JavaScriptValueType | Enumerates the JavaScript data types. |
Functions
Macros
| Name | Description |
|---|---|
| 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 Value | Description |
|---|---|
| ARKWEB_NONE = 0 | Error data. |
| ARKWEB_STRING | String data. |
| ARKWEB_BUFFER | Byte stream data. |
ArkWeb_JavaScriptValueType
enum ArkWeb_JavaScriptValueType
Description
Enumerates the JavaScript data types.
Since: 18
| Enumerated Value | Description |
|---|---|
| ARKWEB_JAVASCRIPT_NONE = 0 | Error data. |
| ARKWEB_JAVASCRIPT_STRING | String data. |
| ARKWEB_JAVASCRIPT_BOOL | Boolean 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
| Name | Description |
|---|---|
| const char* webTag | Name of the Web component. |
| const ArkWeb_JavaScriptBridgeData* data | JavaScriptBridge data. |
| void* userData | Pointer 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
| Name | Description |
|---|---|
| const char* webTag | Name of the Web component. |
| const ArkWeb_JavaScriptBridgeData* dataArray | Pointer to data array. |
| size_t arraySize | Array size. |
| void* userData | Pointer 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
| Name | Description |
|---|---|
| const char* webTag | Name of the Web component. |
| const ArkWeb_JavaScriptBridgeData* dataArray | Pointer to data array. |
| size_t arraySize | Array size. |
| void* userData | Pointer 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
| Name | Description |
|---|---|
| const char* webTag | Name of the Web component. |
| void* userData | Pointer 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
| Name | Description |
|---|---|
| const char* webTag | Name of the Web component. |
| void* userData | Pointer to user-defined data. |
| double x | Scrolling offset of the X axis. |
| double y | Scrolling 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
| Name | Description |
|---|---|
| const char* webTag | Name of the Web component. |
| const ArkWeb_WebMessagePortPtr port | Post message port. |
| const ArkWeb_WebMessagePtr message | Post message data. |
| void* userData | Pointer 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