1# ArkWeb_ControllerAPI 2 3 4## Overview 5 6Defines a native API struct of the Web controller. 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. 7 8**Since**: 12 9 10**Related module**: [Web](_web.md) 11 12 13## Summary 14 15 16### Member Variables 17 18| Name| Description| 19| -------- | -------- | 20| size_t [size](#size) | Size of the struct. | 21| void(\* [runJavaScript](#runjavascript) )(const char \*webTag, const [ArkWeb_JavaScriptObject](_ark_web___java_script_object.md) \*javascriptObject) | Pointer to the function used to inject a JavaScript script. | 22| void(\* [registerJavaScriptProxy](#registerjavascriptproxy) )(const char \*webTag, const [ArkWeb_ProxyObject](_ark_web___proxy_object.md) \*proxyObject) | Pointer to the function used to register a JavaScript proxy with the window. APIs of this object can then be invoked in the window. | 23| void(\* [deleteJavaScriptRegister](#deletejavascriptregister) )(const char \*webTag, const char \*objName) | Pointer to the function used to delete a specific application JavaScript object that is registered with the window using **registerJavaScriptProxy**. | 24| void(\* [refresh](#refresh) )(const char \*webTag) | Pointer to the function used to refresh the web page. | 25| void(\* [registerAsyncJavaScriptProxy](#registerasyncjavascriptproxy) )(const char \*webTag, const [ArkWeb_ProxyObject](_ark_web___proxy_object.md) \*proxyObject) | Pointer to the function used to register a JavaScript proxy with the window. Asynchronous APIs of this object can then be invoked in the window. | 26| [ArkWeb_WebMessagePortPtr](_web.md#arkweb_webmessageportptr) \*(\* [createWebMessagePorts](#createwebmessageports) )(const char \*webTag, size_t \*[size](#size)) | Pointer to the function used to create message ports. | 27| void(\* [destroyWebMessagePorts](#destroywebmessageports) )([ArkWeb_WebMessagePortPtr](_web.md#arkweb_webmessageportptr) \*\*ports, size_t [size](#size)) | Pointer to the function used to destroy message ports. | 28| [ArkWeb_ErrorCode](_web.md#arkweb_errorcode)(\* [postWebMessage](#postwebmessage) )(const char \*webTag, const char \*name, [ArkWeb_WebMessagePortPtr](_web.md#arkweb_webmessageportptr) \*webMessagePorts, size_t [size](#size), const char \*url) | Pointer to the function used to send the message port to the HTML page. | 29 30 31## Member Variable Description 32 33 34### createWebMessagePorts 35 36``` 37ArkWeb_WebMessagePortPtr*(* ArkWeb_ControllerAPI::createWebMessagePorts) (const char *webTag, size_t *size) 38``` 39**Description** 40 41Pointer to the function used to create message ports. 42 43**Parameters** 44 45| Name| Description| 46| -------- | -------- | 47| webTag | Name of the **Web** component. | 48| size | Number of ports, which is an output parameter. | 49 50**Returns** 51 52Pointer to the message port struct. 53 54 55### deleteJavaScriptRegister 56 57``` 58void(* ArkWeb_ControllerAPI::deleteJavaScriptRegister) (const char *webTag, const char *objName) 59``` 60**Description** 61 62Pointer to the function used to delete a specific application JavaScript object that is registered with the window using **registerJavaScriptProxy**. 63 64 65### destroyWebMessagePorts 66 67``` 68void(* ArkWeb_ControllerAPI::destroyWebMessagePorts) (ArkWeb_WebMessagePortPtr *ports, size_t *size) 69``` 70**Description** 71 72Pointer to the function used to destroy message ports. 73 74**Parameters** 75 76| Name| Description| 77| -------- | -------- | 78| ports | Pointer array of the message port struct. | 79| size | Number of ports.| 80 81 82### postWebMessage 83 84``` 85ArkWeb_ErrorCode(* ArkWeb_ControllerAPI::postWebMessage) (const char *webTag, const char *name, ArkWeb_WebMessagePortPtr *webMessagePorts, size_t size, const char *url) 86``` 87**Description** 88 89Pointer to the function used to send the message port to the HTML page. 90 91**Parameters** 92 93| Name| Description| 94| -------- | -------- | 95| webTag | Name of the **Web** component. | 96| name | Name of the message sent to the HTML page. | 97| webMessagePorts | Pointer to the message port struct. | 98| size | Number of ports. | 99| url | URL of the page that receives the message. | 100 101**Returns** 102 103 Returns [ARKWEB_SUCCESS](_web.md) if the operation is successful. Returns [ARKWEB_INVALID_PARAM](_web.md) if the parameter is invalid. Returns [ARKWEB_INIT_ERROR](_web.md) if the initialization fails, that is, the **Web** component bound to the **webTag** is not found. 104 105 106### refresh 107 108``` 109void(* ArkWeb_ControllerAPI::refresh) (const char *webTag) 110``` 111**Description** 112 113Pointer to the function used to refresh the web page. 114 115 116### registerAsyncJavaScriptProxy 117 118``` 119void(* ArkWeb_ControllerAPI::registerAsyncJavaScriptProxy) (const char *webTag, const ArkWeb_ProxyObject *proxyObject) 120``` 121**Description** 122 123Pointer to the function used to register a JavaScript proxy with the window. Asynchronous APIs of this object can then be invoked in the window. 124 125 126### registerJavaScriptProxy 127 128``` 129void(* ArkWeb_ControllerAPI::registerJavaScriptProxy) (const char *webTag, const ArkWeb_ProxyObject *proxyObject) 130``` 131**Description** 132 133Pointer to the function used to register a JavaScript proxy with the window. APIs of this object can then be invoked in the window. 134 135 136### runJavaScript 137 138``` 139void(* ArkWeb_ControllerAPI::runJavaScript) (const char *webTag, const ArkWeb_JavaScriptObject *javascriptObject) 140``` 141**Description** 142 143Pointer to the function used to inject a JavaScript script. 144 145 146### size 147 148``` 149size_t ArkWeb_ControllerAPI::size 150``` 151**Description** 152 153Size of the struct. 154