Available on crate feature
napi only.Structs§
- napi_
async_ cleanup_ hook_ handle__ - napi_
async_ context__ - napi_
async_ work__ - napi_
callback_ info__ - napi_
callback_ scope__ - napi_
critical_ scope__ - napi_
deferred__ - napi_
escapable_ handle_ scope__ - napi_
event_ mode api-12 - Indicates the running mode of the native event loop in an asynchronous native thread.
- napi_
extended_ error_ info - napi_
handle_ scope__ - napi_
key_ collection_ mode - napi_
key_ conversion - napi_
key_ filter - napi_
module - napi_
node_ version - napi_
property_ attributes - napi_
property_ descriptor - napi_
qos_ t - napi_
ref__ - napi_
status - napi_
strong_ ref__ - napi_
task_ priority api-12 - Indicates the priority of a task dispatched from native thread to ArkTS thread.
- napi_
threadsafe_ function__ - napi_
threadsafe_ function_ call_ mode - napi_
threadsafe_ function_ release_ mode - napi_
type_ tag - napi_
typedarray_ type - napi_
valuetype - uv_
loop_ s
Constants§
Functions§
- napi_
acquire_ ⚠threadsafe_ function - Acquires a thread-safe function.
- napi_
add_ ⚠async_ cleanup_ hook api-11 - Registers an asynchronous clean-up hook for releasing resources when the environment exits.
- napi_
add_ ⚠env_ cleanup_ hook api-11 - Registers a clean-up hook for releasing resources when the environment exits.
- napi_
add_ ⚠finalizer api-11 - Adds a ‘napi_finalize’ callback, which will be called when the ArkTS object is garbage-collected.
- napi_
adjust_ ⚠external_ memory - napi_
async_ ⚠destroy api-11 - Destroys the previously created asynchronous context. The capabilities related to ‘async_hook’ are not supported currently.
- napi_
async_ ⚠init api-11 - Creates an asynchronous context. The capabilities related to ‘async_hook’ are not supported currently.
- napi_
call_ ⚠function - Invoke an ArkTS function. This is the primary mechanism to call back into JavaScript.
- napi_
call_ ⚠threadsafe_ function - Calls a thread-safe function.
- napi_
call_ ⚠threadsafe_ function_ with_ priority api-12 - Dispatch a task with specified priority from a native thread to an ArkTS thread, the task will execute the given thread safe function.
- napi_
cancel_ ⚠async_ work - Cancels queued work if it has not yet been started. If it has already started executing, it cannot be cancelled. If successful, the complete callback will be invoked with a status value of napi_cancelled. The work should not be deleted before the complete callback invocation, even if it has been successfully cancelled.
- napi_
check_ ⚠object_ type_ tag - napi_
close_ ⚠callback_ scope api-11 - Closes the callback scope. The capabilities related to ‘async_hook’ are not supported currently.
- napi_
close_ ⚠critical_ scope api-21 - To close a critical scope.
- napi_
close_ ⚠escapable_ handle_ scope - Closes the escapable handle scope passed in.
- napi_
close_ ⚠handle_ scope - Closes the scope passed in. After the scope is closed, all references declared in it are closed.
- napi_
coerce_ ⚠to_ bool - Coerce the given ArkTS value to an ArkTS boolean value.
- napi_
coerce_ ⚠to_ native_ binding_ object api-11 - This API sets native properties to a object and converts this ArkTS object to native binding object.
- napi_
coerce_ ⚠to_ number - Coerce the given ArkTS value to an ArkTS number value.
- napi_
coerce_ ⚠to_ object - Coerce the given ArkTS value to an ArkTS object value.
- napi_
coerce_ ⚠to_ string - Coerce the given ArkTS value to an ArkTS string value.
- napi_
create_ ⚠ark_ context api-20 - To create a new virtual machine context.
- napi_
create_ ⚠ark_ runtime api-12 - Create the ark runtime.
- napi_
create_ ⚠array - Creates an ArkTS array.
- napi_
create_ ⚠array_ with_ length - Creates an ArkTS array of the specified length.
- napi_
create_ ⚠arraybuffer - Creates an ArkTS ArrayBuffer of the specified size.
- napi_
create_ ⚠async_ work - Allocate a work object that is used to execute logic asynchronously.
- napi_
create_ ⚠bigint_ int64 - Creates an ArkTS BigInt from C int64 data.
- napi_
create_ ⚠bigint_ uint64 - Creates an ArkTS BigInt from C int64 data.
- napi_
create_ ⚠bigint_ words - Creates a single ArkTS BigInt from a C uint64 array.
- napi_
create_ ⚠buffer - Creates an ArkTS ArrayBuffer object of the specified size.
- napi_
create_ ⚠buffer_ copy - Creates an ArkTS ArrayBuffer object of the specified size and initializes it with the given data.
- napi_
create_ ⚠dataview - Creates an ArkTS DataView from an existing ArrayBuffer.
- napi_
create_ ⚠date - Creates an ArkTS ‘Date’ object from C double data
- napi_
create_ ⚠double - Creates an ArkTS number from C double data.
- napi_
create_ ⚠error - Creates an ArkTS Error with text information.
- napi_
create_ ⚠external - Allocates a JS value with external data.
- napi_
create_ ⚠external_ arraybuffer - The underlying data that ArrayBuffer point to.
- napi_
create_ ⚠external_ buffer - Creates an ArkTS ArrayBuffer object of the specified size and initializes it with the given data.
- napi_
create_ ⚠function - Create an ArkTS function. This is the primary mechanism to call back into native code from ArkTS.
- napi_
create_ ⚠int32 - Creates an ArkTS number from C int32_t data.
- napi_
create_ ⚠int64 - Creates an ArkTS number from C int64_t data.
- napi_
create_ ⚠object - Creates a default ArkTS object.
- napi_
create_ ⚠object_ with_ named_ properties api-11 - Create ArkTS Object with initial properties given by keys and values, note that property key must be String, and must can not convert to element_index, also all keys must not duplicate.
- napi_
create_ ⚠object_ with_ properties api-11 - Create ArkTS Object with initial properties given by descriptors, note that property key must be String, and must can not convert to element_index, also all keys must not duplicate.
- napi_
create_ ⚠promise - Creates a deferred object and an ArkTS promise.
- napi_
create_ ⚠range_ error - Creates an ArkTS RangeError with text information.
- napi_
create_ ⚠reference - Creates a reference for an object to extend its lifespan. The caller needs to manage the reference lifespan.
- napi_
create_ ⚠sendable_ array api-12 - Create a sendable array.
- napi_
create_ ⚠sendable_ array_ with_ length api-12 - Create a sendable array with length.
- napi_
create_ ⚠sendable_ arraybuffer api-12 - Create a sendable arraybuffer.
- napi_
create_ ⚠sendable_ object_ with_ properties api-12 - Defines a sendable object.
- napi_
create_ ⚠sendable_ typedarray api-12 - Create a sendable typedarray.
- napi_
create_ ⚠string_ latin1 - Creates an ArkTS string from an ISO-8859-1-encoded C string.
- napi_
create_ ⚠string_ utf8 - Creates an ArkTS string from a UTF8-encoded C string.
- napi_
create_ ⚠string_ utf16 - napi_
create_ ⚠strong_ reference api-21 - Creates a strong reference for an ArkTS object to extend its lifespan. The caller needs to manage the reference lifespan.
- napi_
create_ ⚠symbol - Creates an ArkTS symbol.
- napi_
create_ ⚠threadsafe_ function - Creates a thread-safe function.
- napi_
create_ ⚠type_ error - Creates an ArkTS TypeError with text information.
- napi_
create_ ⚠typedarray - Creates an ArkTS TypeArray from an existing ArrayBuffer.
- napi_
create_ ⚠uint32 - Creates an ArkTS number from C uint32_t data.
- napi_
define_ ⚠class - Defines an ArkTS class, including constructor function and properties.
- napi_
define_ ⚠properties - Efficient define multiple properties on the given ArkTS Object by napi_property_descriptor.
- napi_
define_ ⚠sendable_ class api-12 - Defines a sendable class.
- napi_
delete_ ⚠async_ work - Free a previously allocated work object.
- napi_
delete_ ⚠element - Delete the special index from the given ArkTS Array.
- napi_
delete_ ⚠property - Delete the named property of the given ArkTS Object.
- napi_
delete_ ⚠reference - Deletes the reference passed in.
- napi_
delete_ ⚠serialization_ data api-12 - Delete serialization data.
- napi_
delete_ ⚠strong_ reference api-21 - Deletes the strong reference passed in.
- napi_
deserialize ⚠api-12 - Restore serialization data to an ArkTS object.
- napi_
destroy_ ⚠ark_ context api-20 - To destroy a virtual machine context which will not be used again.
- napi_
destroy_ ⚠ark_ runtime api-12 - Destroy the ark runtime.
- napi_
detach_ ⚠arraybuffer - Detaches the underlying data from an ‘ArrayBuffer’ object. After the data is detached, you can operate the data in C/C++.
- napi_
escape_ ⚠handle - Promotes the handle to the input ArkTS object so that it is valid for the lifespan of its outer scope.
- napi_
fatal_ ⚠error - Raises a fatal error to terminate the process immediately.
- napi_
fatal_ ⚠exception api-12 - Throws UncaughtException to ArkTS.
- napi_
get_ ⚠all_ property_ names - Obtains the names of all properties of an ArkTS object.
- napi_
get_ ⚠and_ clear_ last_ exception - Obtains and clears the latest exception.
- napi_
get_ ⚠array_ length - Obtains the array length.
- napi_
get_ ⚠arraybuffer_ info - Obtains the underlying data buffer of ArrayBuffer and its length.
- napi_
get_ ⚠boolean - Obtains the ArkTS singleton value corresponding to given C primitive boolean value.
- napi_
get_ ⚠buffer_ info - Obtains the underlying data of ‘ArrayBuffer’ and its length.
- napi_
get_ ⚠buffer_ string_ utf16_ in_ critical_ scope api-21 - To obtain a ArkTS string buffer cache within the critical scope.
- napi_
get_ ⚠cb_ info - Obtains callback details about the call like arguments, this from given callback info.
- napi_
get_ ⚠dataview_ info - Obtains properties of a DataView.
- napi_
get_ ⚠date_ value - Obtains the C equivalent of the given ArkTS ‘Date’ object.
- napi_
get_ ⚠element - Get the requests element of the given ArkTS Array.
- napi_
get_ ⚠global - Obtains the ArkTS global object.
- napi_
get_ ⚠instance_ data api-11 - Retrieves the data that was previously associated with the currently running environment.
- napi_
get_ ⚠last_ error_ info - Obtains the napi_extended_error_info struct, which contains the latest error information.
- napi_
get_ ⚠named_ property - Get the requests property of the given ArkTS Object.
- napi_
get_ ⚠new_ target - Obtains callback details about the call like arguments, this from given callback info.
- napi_
get_ ⚠node_ version - napi_
get_ ⚠null - Obtains the ArkTS null value.
- napi_
get_ ⚠property - Get the requests property of the given ArkTS Object.
- napi_
get_ ⚠property_ names - Obtains the names of the enumerable properties of object as an Array of Strings. The keys that are symbols will not be included.
- napi_
get_ ⚠prototype - Obtains the prototype of an ArkTS object.
- napi_
get_ ⚠reference_ value - Obtains the ArkTS Object associated with the reference.
- napi_
get_ ⚠strong_ reference_ value api-21 - Obtains the ArkTS Object associated with the strong reference.
- napi_
get_ ⚠threadsafe_ function_ context - Obtains the context of a thread-safe function.
- napi_
get_ ⚠typedarray_ info - Obtains properties of a TypedArray.
- napi_
get_ ⚠undefined - Obtains the ArkTS undefined value.
- napi_
get_ ⚠uv_ event_ loop - Obtains the current libuv loop instance.
- napi_
get_ ⚠value_ bigint_ int64 - Obtains a signed 64-bit integer from an ArkTS BigInt object.
- napi_
get_ ⚠value_ bigint_ uint64 - Obtains an unsigned 64-bit integer from an ArkTS BigInt object.
- napi_
get_ ⚠value_ bigint_ words - Obtains the underlying 64-bit unsigned (uint64) byte data from an ArkTS BigInt object.
- napi_
get_ ⚠value_ bool - Obtains the C Boolean equivalent of an ArkTS Boolean value.
- napi_
get_ ⚠value_ double - Obtains the double value corresponding to the given ArkTS value.
- napi_
get_ ⚠value_ external - Obtains the external data pointer previously passed through napi_create_external().
- napi_
get_ ⚠value_ int32 - Obtains the int32_t value corresponding to the given ArkTS value.
- napi_
get_ ⚠value_ int64 - Obtains the int64_t value corresponding to the given ArkTS value.
- napi_
get_ ⚠value_ string_ latin1 - Obtains the ISO-8859-1-encoded string corresponding to the given ArkTS value.
- napi_
get_ ⚠value_ string_ utf8 - Obtains the UTF8-encoded string corresponding to the given ArkTS value.
- napi_
get_ ⚠value_ string_ utf16 - napi_
get_ ⚠value_ uint32 - Obtains the uint32_t value corresponding to the given ArkTS value.
- napi_
get_ ⚠version - napi_
has_ ⚠element - Check if the given ArkTS Array has an element at the requested index.
- napi_
has_ ⚠named_ property - Check if the given ArkTS Object has the named property or not.
- napi_
has_ ⚠own_ property - Check if the given ArkTS Object has the named own property or not.
- napi_
has_ ⚠property - Check if the given ArkTS Object has the named property or not.
- napi_
instanceof ⚠ - Invoke instanceof operation on the object.
- napi_
is_ ⚠array - Checks if the ArkTS value is an ArkTS Array.
- napi_
is_ ⚠arraybuffer - Checks if the ArkTS value is an ArkTS ArrayBuffer.
- napi_
is_ ⚠buffer - Checks whether the given ArkTS value is a ‘ArrayBuffer’ object.
- napi_
is_ ⚠dataview - Checks if the ArkTS value is an ArkTS DataView.
- napi_
is_ ⚠date - Checks whether the given ArkTS value is a ‘Date’ object. You can use this API to check the type of the parameter passed from ArkTS.
- napi_
is_ ⚠detached_ arraybuffer - Checks whether the given ‘ArrayBuffer’ has been detached.
- napi_
is_ ⚠error - Checks whether a ‘napi_value’ is an error object.
- napi_
is_ ⚠exception_ pending - Checks whether an exception occurs.
- napi_
is_ ⚠promise - Checks whether the given ‘napi_value’ is a promise object.
- napi_
is_ ⚠sendable api-12 - Queries a napi_value to check if it is sendable.
- napi_
is_ ⚠typedarray - Checks if the ArkTS value is an ArkTS TypedArray.
- napi_
load_ ⚠module api-11 - Loads an .abc file as a module. This API returns the namespace of the module.
- napi_
load_ ⚠module_ with_ info api-12 - The module is loaded through the NAPI. By default, the default object is exported from the module.
- napi_
make_ ⚠callback api-11 - Allows an ArkTS function to be called in the asynchronous context. The capabilities related to ‘async_hook’ are not supported currently.
- napi_
module_ ⚠register - Registers a native module.
- napi_
new_ ⚠instance - Instantiate a new ArkTS value using a given napi_value that represents the constructor for the object.
- napi_
object_ ⚠freeze - Freezes an ArkTS object. Once an object is frozen, its properties are immutable.
- napi_
object_ ⚠seal - Seals an ArkTS object. Once an object is sealed, its properties cannot be added or deleted, but property values can be modified.
- napi_
open_ ⚠callback_ scope api-11 - Opens a callback scope. The capabilities related to ‘async_hook’ are not supported currently.
- napi_
open_ ⚠critical_ scope api-21 - To open a critical scope.
- napi_
open_ ⚠escapable_ handle_ scope - Opens an escapable handle scope from which the declared values can be returned to the outer scope.
- napi_
open_ ⚠handle_ scope - Opens a scope.
- napi_
queue_ ⚠async_ work - Requests that the previously allocated work be scheduled for execution. Once it returns successfully, this API must not be called again with the same napi_async_work item or the result will be undefined.
- napi_
queue_ ⚠async_ work_ with_ qos - napi_
ref_ ⚠threadsafe_ function - Indicates that the event loop running on the main thread should not exit until the thread-safe function is destroyed.
- napi_
reference_ ⚠ref - Increments the reference count for the reference passed in and returns the count.
- napi_
reference_ ⚠unref - Decrements the reference count for the reference passed in and returns the count.
- napi_
reject_ ⚠deferred - Rejects a promise by way of the deferred object associated.
- napi_
release_ ⚠threadsafe_ function - Releases a thread-safe function.
- napi_
remove_ ⚠async_ cleanup_ hook api-11 - Unregisters the asynchronous clean-up hook.
- napi_
remove_ ⚠env_ cleanup_ hook api-11 - Unregisters the clean-up hook.
- napi_
remove_ ⚠wrap - Retrieves a native instance that was previously wrapped in the ArkTS object js_object using napi_wrap and removes the wrapping.
- napi_
remove_ ⚠wrap_ sendable api-12 - Retrieves a native instance that was previously wrapped in an ArkTS object and removes the wrapping.
- napi_
resolve_ ⚠deferred - Resolves a promise by way of the deferred object associated.
- napi_
run_ ⚠event_ loop api-12 - Run the event loop by the given env and running mode in current thread.
- napi_
run_ ⚠script - napi_
run_ ⚠script_ path - napi_
serialize ⚠api-12 - Serialize an ArkTS object.
- napi_
set_ ⚠element - Set a element on the given ArkTS Array.
- napi_
set_ ⚠instance_ data api-11 - Associates data with the currently running environment.
- napi_
set_ ⚠named_ property - Set a property on the given ArkTS Object.
- napi_
set_ ⚠property - Set a property on the given ArkTS Object.
- napi_
stop_ ⚠event_ loop api-12 - Stop the event loop in current thread.
- napi_
strict_ ⚠equals - Checks if the two ArkTS values are equal.
- napi_
switch_ ⚠ark_ context api-20 - To switch a virtual machine context which is expected to be used later.
- napi_
throw ⚠ - Throws an ArkTS error.
- napi_
throw_ ⚠error - Throws an ArkTS Error with text information.
- napi_
throw_ ⚠range_ error - Throws an ArkTS RangeError with text information.
- napi_
throw_ ⚠type_ error - Throws an ArkTS TypeError with text information.
- napi_
type_ ⚠tag_ object - napi_
typeof ⚠ - Similar to typeof operation, support external value, detects null as a separate type.
- napi_
unref_ ⚠threadsafe_ function - Indicates that the event loop running on the main thread may exit before the thread-safe function is destroyed.
- napi_
unwrap ⚠ - Retrieves a native instance that was previously wrapped in an ArkTS object using napi_wrap.
- napi_
unwrap_ ⚠sendable api-12 - Retrieves a native instance that was previously wrapped in an ArkTS object.
- napi_
wrap ⚠ - Wraps a native instance in a ArkTS object. The native instance can be retrieved later using napi_unwrap.
- napi_
wrap_ ⚠enhance api-18 - Wraps a native instance in an ArkTS object.
- napi_
wrap_ ⚠sendable api-12 - Wraps a native instance in an ArkTS object.
- napi_
wrap_ ⚠sendable_ with_ size api-12 - Wraps a native instance in an ArkTS object.
- node_
api_ ⚠get_ module_ file_ name api-11 - Obtains the absolute path of the location, from which the addon is loaded.
Type Aliases§
- char16_
t - napi_
addon_ register_ func - napi_
async_ cleanup_ hook - napi_
async_ cleanup_ hook_ handle - napi_
async_ complete_ callback - napi_
async_ context - napi_
async_ execute_ callback - napi_
async_ work - napi_
callback - napi_
callback_ info - napi_
callback_ scope - napi_
critical_ scope api-21 - Native critical scope provides a scope within that an ArkTS string buffer cache can be obtained.
- napi_
deferred - napi_
env - napi_
escapable_ handle_ scope - napi_
finalize - napi_
handle_ scope - napi_
native_ binding_ attach_ callback api-11 - Native attach callback of napi_coerce_to_native_binding_object that can be used to bind the ArkTS object and the native object.
- napi_
native_ binding_ detach_ callback api-11 - Native detach callback of napi_coerce_to_native_binding_object that can be used to detach the ArkTS object and the native object.
- napi_
ref - napi_
strong_ ref api-21 - Native strong reference of an ArkTS object.
- napi_
threadsafe_ function - napi_
threadsafe_ function_ call_ js - napi_
value