b36103fa创建于 2024年11月19日历史提交

native_interface_arkweb.h

Overview

Declares APIs used to inject objects and execute JavaScript code.

Library: libohweb.so

File to include: <web/native_interface_arkweb.h>

System capability: SystemCapability.Web.Webview.Core

Since: 11

Related module: Web

Summary

Types

Name Description
typedef void(* NativeArkWeb_OnJavaScriptCallback) (const char *) Defines a callback used to return the result after the JavaScript code is executed.
typedef char *(* NativeArkWeb_OnJavaScriptProxyCallback) (const char **argv, int32_t argc) Defines a callback of the injected object.
typedef void(* NativeArkWeb_OnValidCallback) (const char *) Defines a callback used when the Web component is valid.
typedef void(* NativeArkWeb_OnDestroyCallback) (const char *) Defines a callback used when the Web component is destroyed.

Functions

Name Description
void OH_NativeArkWeb_RunJavaScript (const char *webTag, const char *jsCode, NativeArkWeb_OnJavaScriptCallback callback) Runs a piece of JavaScript code in the displaying page.
void OH_NativeArkWeb_RegisterJavaScriptProxy (const char *webTag, const char *objName, const char **methodList, NativeArkWeb_OnJavaScriptProxyCallback *callback, int32_t size, bool needRefresh) Registers an object and a list of functions.
void OH_NativeArkWeb_UnregisterJavaScriptProxy (const char *webTag, const char *objName) Unregisters an object. This will deletes the object and its callback function.
void OH_NativeArkWeb_SetJavaScriptProxyValidCallback (const char *webTag, NativeArkWeb_OnValidCallback callback) Sets a callback used when an object can be registered.
NativeArkWeb_OnValidCallback OH_NativeArkWeb_GetJavaScriptProxyValidCallback (const char *webTag) Obtains the callback used when a registered object is valid.
void OH_NativeArkWeb_SetDestroyCallback (const char *webTag, NativeArkWeb_OnDestroyCallback callback) Sets a callback used when a component is destroyed.
NativeArkWeb_OnDestroyCallback OH_NativeArkWeb_GetDestroyCallback (const char *webTag) Obtains the callback used when a registered component is destroyed.