harmony 鸿蒙native_interface_arkweb.h

2025-06-12 浏览 (1)

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

NameDescription
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

NameDescription
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.
ArkWeb_ErrorCode OH_NativeArkWeb_LoadData (const char* webTag,const char* data,const char* mimeType,const char* encoding,const char* baseUrl,const char* historyUrl)Loads data or URLs. This function must be called in the main thread.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkWeb API Reference

harmony 鸿蒙ArkWeb_AnyNativeAPI

harmony 鸿蒙ArkWeb_ComponentAPI

harmony 鸿蒙ArkWeb_ControllerAPI

harmony 鸿蒙ArkWeb_CookieManagerAPI

harmony 鸿蒙ArkWeb_JavaScriptBridgeData

harmony 鸿蒙ArkWeb_JavaScriptObject

harmony 鸿蒙ArkWeb_JavaScriptValueAPI

harmony 鸿蒙ArkWeb_ProxyMethod

harmony 鸿蒙ArkWeb_ProxyMethodWithResult

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/qTXNJk