• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# arkweb_interface.h
2
3## Overview
4
5Declares ArkWeb APIs for obtaining native APIs and the basic native API types.
6
7**Library**: libohweb.so
8
9**System capability**: SystemCapability.Web.Webview.Core
10
11**Since**: 12
12
13**Related module**: [Web](capi-web.md)
14
15## Summary
16
17### Structs
18
19| Name| typedef Keyword| Description|
20| -- | -- | -- |
21| [ArkWeb_AnyNativeAPI](capi-web-arkweb-anynativeapi.md) | ArkWeb_AnyNativeAPI | Defines the basic native API types.|
22
23### Enums
24
25| Name| typedef Keyword| Description|
26| -- | -- | -- |
27| [ArkWeb_NativeAPIVariantKind](#arkweb_nativeapivariantkind) | ArkWeb_NativeAPIVariantKind | Enumerates the native API types.|
28
29### Functions
30
31| Name| Description|
32| -- | -- |
33| [ArkWeb_AnyNativeAPI* OH_ArkWeb_GetNativeAPI(ArkWeb_NativeAPIVariantKind type)](#oh_arkweb_getnativeapi) | Obtains the native API struct based on the transferred API type.|
34| [bool OH_ArkWeb_RegisterScrollCallback(const char* webTag, ArkWeb_OnScrollCallback callback, void* userData)](#oh_arkweb_registerscrollcallback) | Registers a callback for the scroll event.|
35
36## Enum Description
37
38### ArkWeb_NativeAPIVariantKind
39
40```
41enum ArkWeb_NativeAPIVariantKind
42```
43
44**Description**
45
46Enumerates the native API types.
47
48**Since**: 12
49
50| Enumerated Value| Description|
51| -- | -- |
52| ARKWEB_NATIVE_COMPONENT | APIs related to the **Web** component.|
53| ARKWEB_NATIVE_CONTROLLER | APIs related to controller.|
54| ARKWEB_NATIVE_WEB_MESSAGE_PORT | APIs related to **webMessagePort**.|
55| ARKWEB_NATIVE_WEB_MESSAGE | APIs related to **webMessage**.|
56| ARKWEB_NATIVE_COOKIE_MANAGER | APIs related to **cookieManager**.|
57| ARKWEB_NATIVE_JAVASCRIPT_VALUE | APIs related to **JavaScriptValue**.<br>**Since**: 18|
58
59
60## Function Description
61
62### OH_ArkWeb_GetNativeAPI()
63
64```
65ArkWeb_AnyNativeAPI* OH_ArkWeb_GetNativeAPI(ArkWeb_NativeAPIVariantKind type)
66```
67
68**Description**
69
70Obtains the native API struct based on the transferred API type.
71
72**System capability**: SystemCapability.Web.Webview.Core
73
74**Since**: 12
75
76**Parameters**
77
78| Name| Description|
79| -- | -- |
80| [ArkWeb_NativeAPIVariantKind](#arkweb_nativeapivariantkind) type | The native API types supported by ArkWeb.|
81
82**Returns**
83
84| Type                                          | Description|
85|----------------------------------------------| -- |
86| [ArkWeb_AnyNativeAPI](capi-web-arkweb-anynativeapi.md)* | Native API struct pointer corresponding to the input API type. The first member of the struct is the size of the struct.|
87
88### OH_ArkWeb_RegisterScrollCallback()
89
90```
91bool OH_ArkWeb_RegisterScrollCallback(const char* webTag, ArkWeb_OnScrollCallback callback, void* userData)
92```
93
94**Description**
95
96Sets a callback for the scroll event.
97
98**System capability**: SystemCapability.Web.Webview.Core
99
100**Since**: 18
101
102
103**Parameters**
104
105| Name| Description|
106| -- | -- |
107| const char* webTag | Name of the **Web** component.|
108| [ArkWeb_OnScrollCallback](capi-arkweb-type-h.md#arkweb_onscrollcallback) callback | Callback used when a page is scrolled.|
109| void* userData | Pointer to user-defined data.|
110
111**Returns**
112
113| Type| Description|
114| -- | -- |
115| bool | **true** is returned if the operation is successful; otherwise, **false** is returned.|
116