node_api_symbol_for
functionv9js_native_api.hThis API searches in the global registry for an existing symbol with the given description. If the symbol already exists it will be returned, otherwise a new symbol will be created in the registry.
napi_status node_api_symbol_for(napi_env env,
const char* utf8description,
size_t length,
napi_value* result)
[in] env: The environment that the API is invoked under.[in] utf8description: UTF-8 C string representing the text to be used as the description for the symbol.[in] length: The length of the description string in bytes, orNAPI_AUTO_LENGTHif it is null-terminated.[out] result: Anapi_valuerepresenting a JavaScriptsymbol.
Returns napi_ok if the API succeeded.
This API searches in the global registry for an existing symbol with the given description. If the symbol already exists it will be returned, otherwise a new symbol will be created in the registry.
The JavaScript symbol type is described in Section symbol type of the ECMAScript
Language Specification.