napi_set_named_property


napi_status napi_set_named_property(napi_env env,
                                    napi_value object,
                                    const char* utf8Name,
                                    napi_value value); 
  • [in] env:调用 Node-API 调用的环境。

    ¥[in] env: The environment that the Node-API call is invoked under.

  • [in] object:要对其设置属性的对象。

    ¥[in] object: The object on which to set the property.

  • [in] utf8Name:要设置的属性的名称。

    ¥[in] utf8Name: The name of the property to set.

  • [in] value:属性值。

    ¥[in] value: The property value.

如果 API 成功,则返回 napi_ok

¥Returns napi_ok if the API succeeded.

此方法等效于使用从作为 utf8Name 传入的字符串创建的 napi_value 调用 napi_set_property

¥This method is equivalent to calling napi_set_property with a napi_value created from the string passed in as utf8Name.