openharmony 鸿蒙 capi-jsvm-types-h

2026-08-25 浏览 (1)

jsvm_types.h

Overview

Defines JSVM-API types. JSVM-API is used to provide independent, standard, and complete JS engine capabilities, including managing the engine lifecycle, compiling and running JS code, implementing JS/C++ cross-language calls, and taking snapshots.

File to import: <ark_runtime/jsvm_types.h>

Library: libjsvm.so

System capability: SystemCapability.ArkCompiler.JSVM

Since: 11

Related module: JSVM

Summary

Structs

Nametypedef KeywordDescription
JSVM_CallbackStructJSVM_CallbackStructDefines the pointer to the data of the native callbacks provided by the user. These functions are exposed to JavaScript via JSVM-API.
JSVM_HeapStatisticsJSVM_HeapStatisticsStores statistics about JavaScript heap memory usage.
JSVM_InitOptionsJSVM_InitOptionsDefines options for initializing a JavaScript VM.
JSVM_CreateVMOptionsJSVM_CreateVMOptionsDefines options for creating a JavaScript VM.
JSVM_VMInfoJSVM_VMInfoDefines JavaScript VM information.
JSVM_PropertyDescriptorJSVM_PropertyDescriptorDefines property descriptor.
JSVM_ExtendedErrorInfoJSVM_ExtendedErrorInfoDefines extended error information.
JSVM_TypeTagJSVM_TypeTagDefines the type tag, which is stored as a 128-bit value of two unsigned 64-bit integers. As a UUID, it can tag JavaScript objects to ensure that their types remain unchanged.
JSVM_PropertyHandlerConfigurationStructJSVM_PropertyHandlerConfigurationStructDefines a struct for triggering the corresponding callback when the getter, setter, deleter, or enumerator of an object is executed.
JSVM_ScriptOriginJSVM_ScriptOriginDefines the original information about a JavaScript code segment, such as the source map path, source file name, and start line/column number in the source file.
JSVM_CompileOptionsJSVM_CompileOptionsJSVM compilation options, which includes the content and ID.
JSVM_CodeCacheJSVM_CodeCacheAddress and size of the JSVM code cache.
JSVM_PropertyHandlerJSVM_PropertyHandlerDefines the pointer to the callback function triggered when a class is called as a function, and the pointer collection of the callback function triggered when an instance object property is accessed.
JSVM_DefineClassOptionsJSVM_DefineClassOptionsDefines class options.
JSVM_VM__*JSVM_VMDefines a JavaScript VM instance.
JSVM_VMScope__*JSVM_VMScopeDefines the JavaScript VM scope.
JSVM_EnvScope__*JSVM_EnvScopeDefines the environment scope of the current VM instance. The environment is available to the VM instance of the thread only after the thread enters JSVM_EnvScope of the environment through OH_JSVM_OpenEnvScope.
JSVM_Script__*JSVM_ScriptDefines the JavaScript code.
JSVM_Env__*JSVM_EnvDefines the context of a specific VM state. It needs to be passed as a parameter when the native function is called and passed to any subsequent JSVM-API nested call.
JSVM_CpuProfiler__*JSVM_CpuProfilerDefines a JavaScript CPU profiler.
JSVM_Value__*JSVM_ValueDefines the JavaScript value.
JSVM_Data__*JSVM_DataDefines the JavaScript data.
JSVM_Ref__*JSVM_RefDefines the reference to the JavaScript value.
JSVM_HandleScope__*JSVM_HandleScopeDefines the scope of the JavaScript value. It is used to control and modify the lifecycle of an object created in a specific scope. Typically, the JSVM-API value is created in the context of JSVM_HandleScope. When the native method is called from JavaScript, the default JSVM_HandleScope exists. If the user does not explicitly create a new JSVM_HandleScope, the JSVM-API value is created in the default JSVM_HandleScope. For any code call other than native method execution (for example, libuv callback), the module needs to create a scope before calling any function that may create a JavaScript value. JSVM_HandleScope is created using OH_JSVM_OpenHandleScope and destroyed using OH_JSVM_CloseHandleScope. Closing the scope indicates to the GC that all JSVM_Values created during the lifecycle of JSVM_HandleScope will no longer be referenced from the stack frame of the current heap.
JSVM_EscapableHandleScope__*JSVM_EscapableHandleScopeDefines a special type of handle scope, which is used to return the value created in a specific handle scope to the parent scope.
JSVM_CallbackInfo__*JSVM_CallbackInfoDefines an opaque data type passed to the callback. It can be used to obtain additional information about the context in which the function is called.
JSVM_Deferred__*JSVM_DeferredDefines the deferred object.
JSVM_PropertyHandlerConfigurationStruct*JSVM_PropertyHandlerCfgDefines the pointer type of the struct that contains the property handler.
JSVM_CallbackStruct*JSVM_CallbackDefines the pointer types of the native functions provided by user. These functions are exposed to JavaScript via JSVM-API.
JSVM_CompileProfileJSVM_CompileProfileDefines the compilation sampling file transferred together with JSVM_COMPILE_COMPILE_PROFILE.

Enums

Nametypedef KeywordDescription
JSVM_PropertyAttributesJSVM_PropertyAttributesEnumerates the behaviors of controlling JavaScript object properties.
JSVM_ValueTypeJSVM_ValueTypeEnumerates JSVM_Value types.
JSVM_TypedarrayTypeJSVM_TypedarrayTypeEnumerates TypedArray types.
JSVM_StatusJSVM_StatusEnumerates complete status codes indicating whether the JSVM-API call is successful or failed.
JSVM_KeyCollectionModeJSVM_KeyCollectionModeEnumerates ranges of properties to be searched for.
JSVM_KeyFilterJSVM_KeyFilterEnumerates key filters. You can use OR to construct a composite filter.
JSVM_KeyConversionJSVM_KeyConversionEnumerates key conversion options.
JSVM_MemoryPressureLevelJSVM_MemoryPressureLevelEnumerates memory pressure levels.
JSVM_CompileModeJSVM_CompileModeJSVM compilation mode.
JSVM_CompileOptionIdJSVM_CompileOptionIdID of a JSVM compilation option.
JSVM_RegExpFlagsJSVM_RegExpFlagsEnumerates regular expression flags. They can be used to enable a set of flags.
JSVM_InitializedFlagJSVM_InitializedFlagEnumerates the initialization modes of flags.
JSVM_WasmOptLevelJSVM_WasmOptLevelEnumerates WebAssembly optimization levels.
JSVM_CacheTypeJSVM_CacheTypeEnumerates cache types.
JSVM_MicrotaskPolicyJSVM_MicrotaskPolicyEnumerates JSVM microtask execution policies.
JSVM_TraceCategoryJSVM_TraceCategoryEnumerates categories of the JSVM internal trace events.
JSVM_CBTriggerTimeForGCJSVM_CBTriggerTimeForGCEnumerates the timings when the callback is triggered.
JSVM_GCTypeJSVM_GCTypeEnumerates GC types.
JSVM_GCCallbackFlagsJSVM_GCCallbackFlagsEnumerates GC callback flags.
JSVM_PromiseRejectEventJSVM_PromiseRejectEventEnumerates reject events for a promise.
JSVM_MessageErrorLevelJSVM_MessageErrorLevelEnumerates error message levels.
JSVM_DefineClassOptionsIdJSVM_DefineClassOptionsIdEnumerates definition modes for a class.
JSVM_DebugOptionJSVM_DebugOptionEnumerates debugging options.

Functions

Nametypedef KeywordDescription
typedef void (JSVM_CDECL* JSVM_Finalize)(JSVM_Env env,void* finalizeData,void* finalizeHint)JSVM_CDECL* JSVM_FinalizeDefines a pointer to the JSVM_Finalize function. It is passed in when a native object or data is associated with a JavaScript object, and is called when the associated JavaScript object is reclaimed by the GC to execute the native cleanup action.
typedef bool (JSVM_CDECL* JSVM_OutputStream)(const char* data,int size,void* streamData)JSVM_CDECL* JSVM_OutputStreamDefines a pointer to the callback of the ASCII output stream. data indicates the pointer to the output data. size indicates the size of the output data. void is a null pointer that points to the end of the stream. streamData indicates the pointer passed to the API function together with the callback. The API function generates data to the output stream.
typedef void (JSVM_CDECL* JSVM_HandlerForGC)(JSVM_VM vm, JSVM_GCType gcType, JSVM_GCCallbackFlags flags, void* data)JSVM_CDECL* JSVM_HandlerForGCDefines a pointer to the handler for GC callback.
typedef void (JSVM_CDECL* JSVM_HandlerForOOMError)(const char* location,const char* detail,bool isHeapOOM)JSVM_CDECL* JSVM_HandlerForOOMErrorDefines a pointer to the handler for OOM-Error callback.
typedef void (JSVM_CDECL* JSVM_HandlerForFatalError)(const char* location,const char* message)JSVM_CDECL* JSVM_HandlerForFatalErrorDefines a pointer to the handler for Fatal-Error callback.
typedef void (JSVM_CDECL* JSVM_HandlerForPromiseReject)(JSVM_Env env, JSVM_PromiseRejectEvent rejectEvent, JSVM_Value rejectInfo)JSVM_CDECL* JSVM_HandlerForPromiseRejectDefines a pointer to the handler for Promise-Reject callback.

Variables

Nametypedef KeywordDescription
uint16_tchar16_tCreate an alias, char16_t, for uint16_t.
This code ensures that the char16_t type is available in all target compilation environments, even in some old environments that do not support it. char16_t is a new basic data type introduced in C++11. It is used to store 16-bit characters and represent UTF-16-encoded characters.
If the compiler does not recognize char16_t, manually define a custom type whose underlying implementation is a 16-bit unsigned integer. Prerequisite: The current compiler is not a C++ compiler.||It is a Microsoft Visual C++ compiler with a version earlier than Visual Studio 2015 (exclusive).

Enum Description

JSVM_PropertyAttributes

enum JSVM_PropertyAttributes

Description

Enumerates the behaviors of controlling JavaScript object properties.

Since: 11

Enum ItemDescription
JSVM_DEFAULT = 0No explicit attribute set on the property.
JSVM_WRITABLE = 1 << 0Writable property.
JSVM_ENUMERABLE = 1 << 1Enumerable property.
JSVM_CONFIGURABLE = 1 << 2Configurable property.
JSVM_NO_RECEIVER_CHECK = 1 << 3Receiver used to mark the local methods does not need to be checked. If JSVM_NO_RECEIVER_CHECK is not set, the method accepts only the instance of the defined class as the receiver. Otherwise, an exception "TypeError: illegal call" is thrown to the JSVM.
JSVM_STATIC = 1 << 10Static property of the class, instead of the default instance property. Used only by OH_JSVM_DefineClass.
JSVM_DEFAULT_METHOD = JSVM_WRITABLE |JSVM_CONFIGURABLEConfigurable, writable, but not enumerable property, like a method of a JavaScript class.
JSVM_METHOD_NO_RECEIVER_CHECK = JSVM_DEFAULT_METHOD |JSVM_NO_RECEIVER_CHECKClass method whose receiver does not need to be checked.
JSVM_DEFAULT_JSPROPERTY = JSVM_WRITABLE |JSVM_ENUMERABLE |JSVM_CONFIGURABLEWritable, enumerable, and configurable property, like a property set by value assignment in JavaScript.
JSVM_JSPROPERTY_NO_RECEIVER_CHECK = JSVM_DEFAULT_JSPROPERTY |JSVM_NO_RECEIVER_CHECKObject property whose receiver does not need to be checked.

JSVM_ValueType

enum JSVM_ValueType

Description

Enumerates JSVM_Value types.

Since: 11

Enum ItemDescription
JSVM_UNDEFINEDUndefined.
JSVM_NULLNull.
JSVM_BOOLEANBoolean.
JSVM_NUMBERNumber.
JSVM_STRINGString.
JSVM_SYMBOLSymbol.
JSVM_OBJECTObject.
JSVM_FUNCTIONFunction.
JSVM_EXTERNALExternal.
JSVM_BIGINTBigInt.

JSVM_TypedarrayType

enum JSVM_TypedarrayType

Description

Enumerates TypedArray types.

Since: 11

Enum ItemDescription
JSVM_INT8_ARRAYint8 type.
JSVM_UINT8_ARRAYuint8 type.
JSVM_UINT8_CLAMPED_ARRAYFixed uint8 type.
JSVM_INT16_ARRAYint16 type.
JSVM_UINT16_ARRAYuint16 type.
JSVM_INT32_ARRAYint32 type.
JSVM_UINT32_ARRAYuint32 type.
JSVM_FLOAT32_ARRAYfloat32 type.
JSVM_FLOAT64_ARRAYfloat64 type.
JSVM_BIGINT64_ARRAYbigint64 type.
JSVM_BIGUINT64_ARRAYbiguint64 type.

JSVM_Status

enum JSVM_Status

Description

Enumerates complete status codes indicating whether the JSVM-API call is successful or failed.

Since: 11

Enum ItemDescription
JSVM_OKSuccessful.
JSVM_INVALID_ARGInvalid argument.
JSVM_OBJECT_EXPECTEDObject expected.
JSVM_STRING_EXPECTEDString expected.
JSVM_NAME_EXPECTEDName expected.
JSVM_FUNCTION_EXPECTEDFunction expected.
JSVM_NUMBER_EXPECTEDNumber expected.
JSVM_BOOLEAN_EXPECTEDBoolean expected.
JSVM_ARRAY_EXPECTEDArray expected.
JSVM_GENERIC_FAILUREGeneric failure.
JSVM_PENDING_EXCEPTIONPending exception.
JSVM_CANCELLEDCanceled.
JSVM_ESCAPE_CALLED_TWICEEscape called twice.
JSVM_HANDLE_SCOPE_MISMATCHHandle scope mismatch.
JSVM_CALLBACK_SCOPE_MISMATCHCallback scope mismatch.
JSVM_QUEUE_FULLFull queue.
JSVM_CLOSINGClosing.
JSVM_BIGINT_EXPECTEDBigInt expected.
JSVM_DATE_EXPECTEDDate expected.
JSVM_ARRAYBUFFER_EXPECTEDArrayBuffer expected.
JSVM_DETACHABLE_ARRAYBUFFER_EXPECTEDDetachable array buffer expected.
JSVM_WOULD_DEADLOCKWould be in deadlock.
JSVM_NO_EXTERNAL_BUFFERS_ALLOWEDNo external buffers allowed.
JSVM_CANNOT_RUN_JSCannot run JavaSript.
JSVM_INVALID_TYPEInvalid type.
Since: 18
JSVM_JIT_MODE_EXPECTEDJIT mode expected.
Since: 18

JSVM_KeyCollectionMode

enum JSVM_KeyCollectionMode

Description

Enumerates ranges of properties to be searched for.

Since: 11

Enum ItemDescription
JSVM_KEY_INCLUDE_PROTOTYPESProperties on the prototype chain of the object are included.
JSVM_KEY_OWN_ONLYOnly the object's own properties are included.

JSVM_KeyFilter

enum JSVM_KeyFilter

Description

Enumerates key filters. You can use OR to construct a composite filter.

Since: 11

Enum ItemDescription
JSVM_KEY_ALL_PROPERTIES = 0Key of all properties.
JSVM_KEY_WRITABLE = 1Writable key.
JSVM_KEY_ENUMERABLE = 1 << 1Enumerable key.
JSVM_KEY_CONFIGURABLE = 1 << 2Configurable key.
JSVM_KEY_SKIP_STRINGS = 1 << 3Key that skips strings.
JSVM_KEY_SKIP_SYMBOLS = 1 << 4Key that skips symbols.

JSVM_KeyConversion

enum JSVM_KeyConversion

Description

Enumerates key conversion options.

Since: 11

Enum ItemDescription
JSVM_KEY_KEEP_NUMBERSReturns the numbers of integer indexes.
JSVM_KEY_NUMBERS_TO_STRINGSConverts integer indexes to strings.

JSVM_MemoryPressureLevel

enum JSVM_MemoryPressureLevel

Description

Enumerates memory pressure levels.

Since: 11

Enum ItemDescription
JSVM_MEMORY_PRESSURE_LEVEL_NONENo pressure.
JSVM_MEMORY_PRESSURE_LEVEL_MODERATEModerate pressure.
JSVM_MEMORY_PRESSURE_LEVEL_CRITICALCritical pressure.
JSVM_MEMORY_PRESSURE_LEVEL_LOW_MEMORYThe system is notified that the memory is insufficient and garbage collection is triggered immediately.
Since: 22

JSVM_CompileMode

enum JSVM_CompileMode

Description

Defines an enum for the compilation modes when id is JSVM_COMPILE_MODE.

Since: 12

Enum ItemDescription
JSVM_COMPILE_MODE_DEFAULTDefault compilation mode.
JSVM_COMPILE_MODE_CONSUME_CODE_CACHEMode that consumes the code cache.
JSVM_COMPILE_MODE_EAGER_COMPILEEager compilation mode.
JSVM_COMPILE_MODE_PRODUCE_COMPILE_PROFILEMode that generates the compilation profile.
JSVM_COMPILE_MODE_CONSUME_COMPILE_PROFILEMode that consumes the compilation profile.

JSVM_CompileOptionId

enum JSVM_CompileOptionId

Description

Defines an enum for id in JSVM_CompileOptions. Each id corresponds to a content value. The value JSVM_COMPILE_ENABLE_SOURCE_MAP is a Boolean, and is valid only when sourceMapUrl in JSVM_ScriptOrigin is not empty.

Since: 12

Enum ItemDescription
JSVM_COMPILE_MODEJSVM compilation mode.
JSVM_COMPILE_CODE_CACHEJSVM code cache.
JSVM_COMPILE_SCRIPT_ORIGINJSVM script origin.
JSVM_COMPILE_COMPILE_PROFILEJSVM compilation profile.
JSVM_COMPILE_ENABLE_SOURCE_MAPSource map enablement status of JSVM.

JSVM_RegExpFlags

enum JSVM_RegExpFlags

Description

Enumerates regular expression flags. They can be used to enable a set of flags.

Since: 12

Enum ItemDescription
JSVM_REGEXP_NONE = 0None mode.
JSVM_REGEXP_GLOBAL = 1 << 0Global mode.
JSVM_REGEXP_IGNORE_CASE = 1 << 1Ignore Case mode.
JSVM_REGEXP_MULTILINE = 1 << 2Multiline mode.
JSVM_REGEXP_STICKY = 1 << 3Sticky mode.
JSVM_REGEXP_UNICODE = 1 << 4Unicode mode.
JSVM_REGEXP_DOT_ALL = 1 << 5dotAll mode.
JSVM_REGEXP_LINEAR = 1 << 6Linear mode.
JSVM_REGEXP_HAS_INDICES = 1 << 7Has Indices mode.
JSVM_REGEXP_UNICODE_SETS = 1 << 8Unicode Sets mode.

JSVM_InitializedFlag

enum JSVM_InitializedFlag

Description

Enumerates the initialization modes of flags.

Since: 12

Enum ItemDescription
JSVM_ZERO_INITIALIZEDFlags are initialized to 0.
JSVM_UNINITIALIZEDNo initialization.

JSVM_WasmOptLevel

enum JSVM_WasmOptLevel

Description

Enumerates WebAssembly optimization levels.

Since: 12

Enum ItemDescription
JSVM_WASM_OPT_BASELINE = 10Baseline optimization level.
JSVM_WASM_OPT_HIGH = 20High optimization level.

JSVM_CacheType

enum JSVM_CacheType

Description

Enumerates cache types.

Since: 12

Enum ItemDescription
JSVM_CACHE_TYPE_JSJavaScript cache, which is generated by OH_JSVM_CreateCodeCache.
JSVM_CACHE_TYPE_WASMWebAssembly cache, which is generated by OH_JSVM_CreateWasmCache.

JSVM_MicrotaskPolicy

enum JSVM_MicrotaskPolicy

Description

Enumerates JSVM microtask execution policies.

Since: 18

Enum ItemDescription
JSVM_MICROTASK_EXPLICIT = 0Microtasks are executed after the OH_JSVM_PerformMicrotaskCheckpoint method is called.
JSVM_MICROTASK_AUTOMicrotasks are automatically executed when the JS call stack is 0. This policy is used by default.

JSVM_TraceCategory

enum JSVM_TraceCategory

Description

Enumerates categories of the JSVM internal trace events.

Since: 18

Enum ItemDescription
JSVM_TRACE_VMCollects the calls of main JSVM APIs, for example, executing JS scripts.
JSVM_TRACE_COMPILECollects the calls of compilation APIs, for example, background compilation.
JSVM_TRACE_EXECUTECollects the calls of APIs related to the running status, for example, task interruption and microtasks.
JSVM_TRACE_RUNTIMECollects information about the external function calls.
JSVM_TRACE_STACK_TRACECollects stack trace information from the JSVM.
JSVM_TRACE_WASMCollects the calls of main WASM APIs, for example, compiling and instantiating WASM modules.
JSVM_TRACE_WASM_DETAILEDCollects detailed WASM API calls, for example, background compilation and jumpboard compilation.

JSVM_CBTriggerTimeForGC

enum JSVM_CBTriggerTimeForGC

Description

Enumerates the timings when the callback is triggered.

Since: 18

Enum ItemDescription
JSVM_CB_TRIGGER_BEFORE_GCA callback function is triggered before GC.
JSVM_CB_TRIGGER_AFTER_GCA callback function is triggered after GC.

JSVM_GCType

enum JSVM_GCType

Description

Enumerates GC types.

Since: 18

Enum ItemDescription
JSVM_GC_TYPE_SCAVENGE = 1 << 0The GC algorithm is Scavenge.
JSVM_GC_TYPE_MINOR_MARK_COMPACT = 1 << 1The GC algorithm is Minor-Mark-Compact.
JSVM_GC_TYPE_MARK_SWEEP_COMPACT = 1 << 2The GC algorithm is Mark-Sweep-Compact.
JSVM_GC_TYPE_INCREMENTAL_MARKING = 1 << 3The GC algorithm is Incremental-Marking.
JSVM_GC_TYPE_PROCESS_WEAK_CALLBACKS = 1 << 4The GC algorithm is Weak-Callbacks.
JSVM_GC_TYPE_ALL = JSVM_GC_TYPE_SCAVENGE |JSVM_GC_TYPE_MINOR_MARK_COMPACT |JSVM_GC_TYPE_MARK_SWEEP_COMPACT |JSVM_GC_TYPE_INCREMENTAL_MARKING |JSVM_GC_TYPE_PROCESS_WEAK_CALLBACKSAll types of GC algorithms are included.

JSVM_GCCallbackFlags

enum JSVM_GCCallbackFlags

Description

Enumerates GC callback flags.

Since: 18

Enum ItemDescription
JSVM_NO_GC_CALLBACK_FLAGSNo callback flag.
JSVM_GC_CALLBACK_CONSTRUCT_RETAINED_OBJECT_INFOSBuilds reserved object information in the GC callback.
JSVM_GC_CALLBACK_FORCEDForcibly executes the GC callback.
JSVM_GC_CALLBACK_SYNCHRONOUS_PHANTOM_CALLBACK_PROCESSINGSynchronously processes ghost object callbacks.
JSVM_GC_CALLBACK_COLLECT_ALL_AVAILABLE_GARBAGECollects all available garbage objects during GC.
JSVM_GC_CALLBACK_COLLECT_ALL_EXTERNAL_MEMORYCollects all external memory during GC.
JSVM_GC_CALLBACK_SCHEDULE_IDLE_GARBAGE_COLLECTIONSchedules GC when idle.

JSVM_PromiseRejectEvent

enum JSVM_PromiseRejectEvent

Description

Enumerates reject events for a promise.

Since: 18

Enum ItemDescription
JSVM_PROMISE_REJECT_OTHER_REASONS = 0A promise is rejected, but the rejection reason is unknown or unclear.
JSVM_PROMISE_REJECT_WITH_NO_HANDLER = 1A promise is rejected but no handler is available.
JSVM_PROMISE_ADD_HANDLER_AFTER_REJECTED = 2A handler is added after a promise is rejected.
JSVM_PROMISE_REJECT_AFTER_RESOLVED = 3Attempts to reject a promise after this promise is resolved.
JSVM_PROMISE_RESOLVE_AFTER_RESOLVED = 4Attempts to resolve a promise after this promise is resolved.

JSVM_MessageErrorLevel

enum JSVM_MessageErrorLevel

Description

Enumerates error message levels.

Since: 18

Enum ItemDescription
JSVM_MESSAGE_LOG = (1 << 0)Logs.
JSVM_MESSAGE_DEBUG = (1 << 1)Debugging messages.
JSVM_MESSAGE_INFO = (1 << 2)Information.
JSVM_MESSAGE_ERROR = (1 << 3)Errors.
JSVM_MESSAGE_WARNING = (1 << 4)Warnings.
JSVM_MESSAGE_ALL = JSVM_MESSAGE_LOG |JSVM_MESSAGE_DEBUG |JSVM_MESSAGE_INFO |JSVM_MESSAGE_ERROR |JSVM_MESSAGE_WARNINGInformation of all levels.

JSVM_DefineClassOptionsId

enum JSVM_DefineClassOptionsId

Description

Enumerates definition modes for a class.

Since: 18

Enum ItemDescription
JSVM_DEFINE_CLASS_NORMALDefines a class in normal mode.
JSVM_DEFINE_CLASS_WITH_COUNTReserves a specified number of interfield slots for the created class. Native data can be stored in these slots.
JSVM_DEFINE_CLASS_WITH_PROPERTY_HANDLERSets a listener property for the created class and sets a callback to be invoked when it is called as a function.

JSVM_DebugOption

enum JSVM_DebugOption

Description

Enumerates debugging options.

Since: 20

Enum ItemDescription
JSVM_SCOPE_CHECKScope check.

Function Description

JSVM_Finalize()

typedef void (JSVM_CDECL* JSVM_Finalize)(JSVM_Env env,void* finalizeData,void* finalizeHint)

Description

Defines a pointer to the JSVM_Finalize function. It is passed in when a native object or data is associated with a JavaScript object, and is called when the associated JavaScript object is reclaimed by the GC to execute the native cleanup action.

Since: 11

JSVM_OutputStream()

typedef bool (JSVM_CDECL* JSVM_OutputStream)(const char* data,int size,void* streamData)

Description

Defines a pointer to the callback of the ASCII output stream. data indicates the pointer to the output data. size indicates the size of the output data. void is a null pointer that points to the end of the stream. streamData indicates the pointer passed to the API function together with the callback. The API function generates data to the output stream.

Since: 12

Returns

TypeDescription
boolReturns true if the stream can continue to receive data; returns false if the stream is closed.

JSVM_HandlerForGC()

typedef void (JSVM_CDECL* JSVM_HandlerForGC)(JSVM_VM vm, JSVM_GCType gcType, JSVM_GCCallbackFlags flags, void* data)

Description

Defines a pointer to the handler for GC callback.

Since: 18

JSVM_HandlerForOOMError()

typedef void (JSVM_CDECL* JSVM_HandlerForOOMError)(const char* location,const char* detail,bool isHeapOOM)

Description

Defines a pointer to the handler for OOM-Error callback.

Since: 18

JSVM_HandlerForFatalError()

typedef void (JSVM_CDECL* JSVM_HandlerForFatalError)(const char* location,const char* message)

Description

Defines a pointer to the handler for Fatal-Error callback.

Since: 18

JSVM_HandlerForPromiseReject()

typedef void (JSVM_CDECL* JSVM_HandlerForPromiseReject)(JSVM_Env env, JSVM_PromiseRejectEvent rejectEvent, JSVM_Value rejectInfo)

Description

Defines a pointer to the handler for Promise-Reject callback.

Since: 18

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-jsvm-jsvm-vminfo

openharmony 鸿蒙 capi-memory

openharmony 鸿蒙 js-apis-syscap

openharmony 鸿蒙 capi-memory-purgmem

openharmony 鸿蒙 capi-jsvm-jsvm-callbackstruct8h

openharmony 鸿蒙 capi-jsvm-jsvm-propertydescriptor

openharmony 鸿蒙 js-apis-common-load-native-module

openharmony 鸿蒙 capi-jsvm-jsvm-cpuprofiler--8h

openharmony 鸿蒙 capi-jsvm-jsvm-codecache

openharmony 鸿蒙 capi-jsvm-jsvm-data--8h

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