napi_set_property

Function napi_set_property 

Source
pub unsafe extern "C" fn napi_set_property(
    env: napi_env,
    object: napi_value,
    key: napi_value,
    value: napi_value,
) -> napi_status
Available on crate feature napi only.
Expand description

Set a property on the given ArkTS Object.

§Arguments

  • env - Current running virtual machine context.

  • object - The ArkTS object.

  • key - The name of the property to set.

  • value - The property value.

§Returns

  • Returns the function execution status. [napi_ok] If the function executed successfully.

[napi_invalid_arg] If the param env, object, key and(or) value is nullptr.

[napi_object_expected] If the param object is not an ArkTS Object.

[napi_pending_exception] If have uncaught exception, or exception occurred in execution.

Available since API-level: 10