mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-27 00:41:01 +00:00
JD ndk jsb
Signed-off-by: j00466033 <jianglinyang@huawei.com>
This commit is contained in:
parent
224260db6e
commit
d93a226ebe
@ -65,6 +65,12 @@ typedef enum {
|
||||
ARKWEB_NATIVE_WEB_MESSAGE,
|
||||
/** API type related to ArkWeb cookie manager. */
|
||||
ARKWEB_NATIVE_COOKIE_MANAGER,
|
||||
/**
|
||||
* @brief API type related to ArkWeb JavaScript value.
|
||||
*
|
||||
* @since 14
|
||||
*/
|
||||
ARKWEB_NATIVE_JAVASCRIPT_VALUE,
|
||||
} ArkWeb_NativeAPIVariantKind;
|
||||
|
||||
/*
|
||||
|
@ -68,6 +68,20 @@ typedef enum ArkWeb_WebMessageType {
|
||||
ARKWEB_BUFFER
|
||||
} ArkWeb_WebMessageType;
|
||||
|
||||
/**
|
||||
* @brief Defines the data type carried in a ArkWeb_JavaScriptValue.
|
||||
*
|
||||
* @since 14
|
||||
*/
|
||||
typedef enum ArkWeb_JavaScriptValueType {
|
||||
/** Represent error data */
|
||||
ARKWEB_JAVASCRIPT_NONE = 0,
|
||||
/** The data carried in the ArkWeb_JavaScriptValue is string. */
|
||||
ARKWEB_JAVASCRIPT_STRING,
|
||||
/** The data carried in the ArkWeb_JavaScriptValue is bool. */
|
||||
ARKWEB_JAVASCRIPT_BOOL
|
||||
} ArkWeb_JavaScriptValueType;
|
||||
|
||||
/**
|
||||
* @brief Defines the ArkWeb_WebMessage.
|
||||
*
|
||||
@ -75,6 +89,13 @@ typedef enum ArkWeb_WebMessageType {
|
||||
*/
|
||||
typedef struct ArkWeb_WebMessage* ArkWeb_WebMessagePtr;
|
||||
|
||||
/**
|
||||
* @brief Defines the ArkWeb_JavaScriptValuePtr.
|
||||
*
|
||||
* @since 14
|
||||
*/
|
||||
typedef struct ArkWeb_JavaScriptValue* ArkWeb_JavaScriptValuePtr;
|
||||
|
||||
/**
|
||||
* @brief Defines the javascript callback of the native ArkWeb.
|
||||
*
|
||||
@ -91,6 +112,19 @@ typedef void (*ArkWeb_OnJavaScriptCallback)(
|
||||
typedef void (*ArkWeb_OnJavaScriptProxyCallback)(
|
||||
const char* webTag, const ArkWeb_JavaScriptBridgeData* dataArray, size_t arraySize, void* userData);
|
||||
|
||||
/**
|
||||
* @brief Defines the JavaScript proxy callback of the native ArkWeb.
|
||||
*
|
||||
* @param webTag The name of the web component.
|
||||
* @param dataArray The JavaScript bridge data array from HTML.
|
||||
* @param arraySize The number of elements in the array.
|
||||
* @param userData The data set by user.
|
||||
*
|
||||
* @since 14
|
||||
*/
|
||||
typedef ArkWeb_JavaScriptValuePtr (*ArkWeb_OnJavaScriptProxyCallbackWithResult)(
|
||||
const char* webTag, const ArkWeb_JavaScriptBridgeData* dataArray, size_t arraySize, void* userData);
|
||||
|
||||
/**
|
||||
* @brief Defines the component callback of the native ArkWeb.
|
||||
*
|
||||
@ -148,6 +182,20 @@ typedef struct {
|
||||
void* userData;
|
||||
} ArkWeb_ProxyMethod;
|
||||
|
||||
/**
|
||||
* @brief Defines the JavaScript proxy method with a return value.
|
||||
*
|
||||
* @since 14
|
||||
*/
|
||||
typedef struct {
|
||||
/** The method of the application side JavaScript object participating in the registration. */
|
||||
const char* methodName;
|
||||
/** The callback function with a return value registered by developer is called back when HTML side uses. */
|
||||
ArkWeb_OnJavaScriptProxyCallbackWithResult callback;
|
||||
/** The user data to set. */
|
||||
void* userData;
|
||||
} ArkWeb_ProxyMethodWithResult;
|
||||
|
||||
/**
|
||||
* @brief Defines the javascript proxy registered object.
|
||||
*
|
||||
@ -162,6 +210,20 @@ typedef struct {
|
||||
size_t size;
|
||||
} ArkWeb_ProxyObject;
|
||||
|
||||
/**
|
||||
* @brief Defines the JavaScript proxy registered object with methodList that has a return value.
|
||||
*
|
||||
* @since 14
|
||||
*/
|
||||
typedef struct {
|
||||
/** The name of the registered object. */
|
||||
const char* objName;
|
||||
/** The JavaScript proxy registered method object list with a callback function that has a return value */
|
||||
const ArkWeb_ProxyMethodWithResult* methodList;
|
||||
/** The size of the methodList. */
|
||||
size_t size;
|
||||
} ArkWeb_ProxyObjectWithResult;
|
||||
|
||||
/**
|
||||
* @brief Defines the controller API for native ArkWeb.
|
||||
* Before invoking an API, you are advised to use ARKWEB_MEMBER_MISSING to check
|
||||
@ -223,6 +285,32 @@ typedef struct {
|
||||
* @since 14
|
||||
*/
|
||||
const char* (*getLastJavascriptProxyCallingFrameUrl)();
|
||||
|
||||
/**
|
||||
* @brief Register the JavaScript object and method list, the method is callback function that has a return value.
|
||||
*
|
||||
* @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 14
|
||||
*/
|
||||
void (*registerJavaScriptProxyEx)(const char* webTag, const ArkWeb_ProxyObjectWithResult* proxyObject,
|
||||
const char* permission);
|
||||
|
||||
/**
|
||||
* @brief Register the JavaScript object and async method list.
|
||||
*
|
||||
* @param webTag The name of the web component.
|
||||
* @param proxyObject The JavaScript object to register.
|
||||
* @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 14
|
||||
*/
|
||||
void (*registerAsyncJavaScriptProxyEx)(const char* webTag, const ArkWeb_ProxyObject* proxyObject,
|
||||
const char* permission);
|
||||
} ArkWeb_ControllerAPI;
|
||||
|
||||
/**
|
||||
@ -353,7 +441,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
/** The ArkWeb_CookieManagerAPI struct size. */
|
||||
size_t size;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Obtains the cookie value corresponding to a specified URL.
|
||||
*
|
||||
@ -408,6 +496,30 @@ typedef struct {
|
||||
void (*clearSessionCookiesSync)();
|
||||
} ArkWeb_CookieManagerAPI;
|
||||
|
||||
/**
|
||||
* @brief Defines the native JavaScriptValue API for ArkWeb.
|
||||
* Before invoking an API, you are advised to use ARKWEB_MEMBER_MISSING to check
|
||||
* whether the function structure has a corresponding function pointer to avoid crash
|
||||
* caused by mismatch between the SDK and the device ROM.
|
||||
*
|
||||
* @since 14
|
||||
*/
|
||||
typedef struct {
|
||||
/** The ArkWeb_JavaScriptValueAPI struct size. */
|
||||
size_t size;
|
||||
|
||||
/**
|
||||
* @brief Create the JavaScript value responding to HTML.
|
||||
*
|
||||
* @param type The type of ArkWeb_JavaScriptValue.
|
||||
* @param data The data buffer of ArkWeb_JavaScriptValue.
|
||||
* @param dataLength The length of data buffer.
|
||||
* @return ArkWeb_JavaScriptValuePtr created by ArkWeb, the memory of ArkWeb_JavaScriptValue
|
||||
* is managed by ArkWeb itself.
|
||||
*/
|
||||
ArkWeb_JavaScriptValuePtr (*createJavaScriptValue)(ArkWeb_JavaScriptValueType type, void* data, size_t dataLength);
|
||||
} ArkWeb_JavaScriptValueAPI;
|
||||
|
||||
/**
|
||||
* @brief Check whether the member variables of the current struct exist.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user