napi_create_symbol


napi_status napi_create_symbol(napi_env env,
                               napi_value description,
                               napi_value* result) 
  • [in] env:调用 API 的环境。

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

  • [in] description:可选的 napi_value,它指的是要设置为符号描述的 JavaScript string

    ¥[in] description: Optional napi_value which refers to a JavaScript string to be set as the description for the symbol.

  • [out] result:代表 JavaScript symbolnapi_value

    ¥[out] result: A napi_value representing a JavaScript symbol.

如果 API 成功,则返回 napi_ok

¥Returns napi_ok if the API succeeded.

此 API 从 UTF8 编码的 C 字符串创建 JavaScript symbol 值。

¥This API creates a JavaScript symbol value from a UTF8-encoded C string.

JavaScript symbol 类型在 ECMAScript 语言规范的 第 19.4 节 中进行了描述。

¥The JavaScript symbol type is described in Section 19.4 of the ECMAScript Language Specification.